# Event Feed

> Live list of a contract's events, newest first, each linked to its transaction.

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

Follow a contract's events as they happen: transfers, swaps, mints. New events appear at the top, each with its arguments and a link to the transaction. Screen readers hear new entries politely (`role="log"`).

## Installation

```bash
npx shadcn@latest add @0xui/event-feed
```

## Usage

```tsx
import { EventFeed } from "@/components/event-feed";

<EventFeed address={usdc} abi={erc20Abi} eventName="Transfer" args={{ to: address }} />;
```

`args` filters on indexed arguments, so `{ to: address }` shows only incoming transfers. `historyBlocks` loads that many recent blocks first. Keep it small: public RPCs cap how many blocks one log request may cover.

### Custom rows

```tsx
<EventFeed
  address={pool}
  abi={poolAbi}
  eventName="Swap"
  renderEvent={(event) => <SwapRow args={event.args} />}
/>
```

Headless: `useEventFeed(params)` returns `events`, newest first and deduplicated.

> **Tip: In production**
>
> `historyBlocks` reads past events over RPC, and providers cap those ranges. For real history, we recommend an [index of the chain](https://0xui.io/getting-started/indexed-data.md), either your own (ClickHouse is built for event logs) or a service like Goldsky. Pass its events to `initialEvents`, and new events still stream in live:
>
> ```tsx
> <EventFeed address={pool} abi={poolAbi} eventName="Swap" initialEvents={eventsFromYourIndex} />
> ```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `address` | `Address` | — | Contract. |
| `abi` | `Abi` | — | ABI with the event. |
| `eventName` | `string` | all | Event to follow. |
| `args` | `object` | — | Indexed-argument filter. |
| `chainId` | `number` | current | Chain. |
| `historyBlocks` | `number` | `0` | Recent blocks to load first. |
| `max` | `number` | `20` | Events kept. |
| `initialEvents` | `FeedEvent[]` | — | Past events from your own source. |
| `renderEvent` | `(event) => ReactNode` | — | Custom row. |
| `title` | `ReactNode` | `"Live events"` | Heading. `null` hides it. |
