# Transaction History

> Transactions sent from your app, with live status. Stored in the browser.

- Install: `npx shadcn@latest add @0xui/transaction-history`
- Registry JSON: https://0xui.io/r/transaction-history.json
- Source: https://github.com/fimbul-lab/0xui/blob/main/registry/default/components/transaction-history.tsx

A list of transactions sent from your app, newest first. Pending ones update live, and settled ones keep their result. It's stored in this browser (`localStorage`), so it's per device and survives reloads. Other tabs update too.

Connect the **Demo Wallet** and send a couple.

## Installation

```bash
npx shadcn@latest add @0xui/transaction-history
```

## Usage

Record transactions wherever you send them, then render the list anywhere:

```tsx
import { TransactionHistory, recordTransaction } from "@/components/transaction-history";

<TransactionButton
  transaction={tx}
  onSubmitted={(hash) =>
    recordTransaction({ hash, chainId: 1, from: address, description: "Send 0.1 ETH" })
  }
/>

<TransactionHistory />
```

By default, the list shows the connected account's transactions (entries recorded with `from`). Pass `from={null}` to show all. `recordTransaction` works outside React too. It keeps the 50 most recent.

> **Tip: In production**
>
> Local history only knows what this browser recorded. For full history across devices and apps, we recommend an [index of the chain](https://0xui.io/getting-started/indexed-data.md), either your own (Postgres + ClickHouse) or a service like Goldsky. Pass its rows to `transactions`. Pending ones still update live:
>
> ```tsx
> <TransactionHistory transactions={transactionsFromYourIndex} />
> ```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `from` | `Address \| null` | connected | Filter by sender. `null` shows all. |
| `transactions` | `HistoryEntry[]` | — | Transactions from your own source instead of this browser's. |
| `pageSize` | `number` | `10` | Rows per page, with "Show more". |
| `clearable` | `boolean` | `true` | Show a Clear button. |
| `title` | `ReactNode` | `"Recent transactions"` | Heading. |
| `locale` | `string` | runtime locale | Locale for the relative times. |

Also exported: `useTransactionHistory`, `updateTransaction`, `clearTransactionHistory`.
