Transaction row
bitcoin-ui/transaction-rowFreeComponent
Transaction summary for explorer and wallet lists.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/dennisonbertram/bitcoin-ui/main/public/r/transaction-row.jsonSource
1import type { ComponentProps } from "react";23import {4 feeRateFrom,5 formatFeeRate,6 formatRelativeTime,7 toDate,8 type BitcoinTransaction,9} from "@/lib/bitcoin";10import { componentClasses } from "@/lib/utils";1112import { BitcoinAmount } from "./bitcoin-amount";13import { ConfirmationProgress } from "./confirmation-progress";14import { HashDisplay } from "./hash-display";15import { type BitcoinVisualProps } from "./shared";16import { StatusBadge } from "./status-badge";1718export type TransactionRowProps = Omit<ComponentProps<"article">, "children"> &19 BitcoinVisualProps & {20 transaction: BitcoinTransaction;21 href?: string;22 now?: number | Date;23 };2425export function TransactionRow({26 transaction,27 href,28 now,29 unstyled,30 className,31 ...props32}: TransactionRowProps) {33 const feeRate = feeRateFrom(transaction.fee, transaction.vsize);3435 return (36 <article37 data-slot="transaction-row"38 data-state={transaction.state}39 data-unstyled={unstyled || undefined}40 className={componentClasses(41 unstyled,42 "grid min-w-0 gap-4 border-b border-[var(--color-rule-subtle)] py-4 last:border-b-0 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center",43 className,44 )}45 {...props}46 >47 <div className="grid min-w-0 gap-2">48 <HashDisplay49 value={transaction.txid}50 label="Transaction ID"51 href={href}52 unstyled={unstyled}53 />54 <div55 className={componentClasses(56 unstyled,57 "flex flex-wrap items-center gap-x-3 gap-y-2",58 )}59 >60 <StatusBadge state={transaction.state} unstyled={unstyled} />61 <span62 className={componentClasses(63 unstyled,64 "font-mono text-xs tabular-nums text-[var(--color-muted)]",65 )}66 >67 {formatFeeRate(feeRate)}68 </span>69 {transaction.timestamp ? (70 <time71 dateTime={toDate(transaction.timestamp).toISOString()}72 className={componentClasses(73 unstyled,74 "text-xs text-[var(--color-muted)]",75 )}76 >77 {formatRelativeTime(transaction.timestamp, now)}78 </time>79 ) : null}80 </div>81 </div>82 <div83 className={componentClasses(84 unstyled,85 "grid justify-items-start gap-2 sm:justify-items-end",86 )}87 >88// … truncated
What it pulls in
Other registry items
Files it writes
More from bitcoin-ui
All 23 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Address displayaddress-display | bitcoin-ui | Components | Free | no deps | |
| Bitcoin amountbitcoin-amount | bitcoin-ui | Components | Free | no deps | |
| Bitcoin motionbitcoin-motion | bitcoin-ui | Components | Free | no deps · 2 files | |
| Bitcoin searchbitcoin-search | bitcoin-ui | Components | Free | 1 dep | |
| Block cardblock-card | bitcoin-ui | Components | Free | 1 dep | |
| Block listblock-list | bitcoin-ui | Components | Free | no deps | |
| Confirmation progressconfirmation-progress | bitcoin-ui | Components | Free | no deps | |
| Difficulty adjustmentdifficulty-adjustment | bitcoin-ui | Components | Free | no deps |
