<!-- Generated by scripts/gen-docs.mts from the JSDoc in registry/. Do not edit; run `pnpm run docs`. -->

# ReadReceipt

Who has seen a message, as small faces under it: the first three readers, overlapping, then "+N" for the rest. Screen readers hear it in words ("Seen by Ana Lind, Ben Ito and 2 others"), and the faces are hidden from them.

## Install

Once per app, with Tailwind CSS v4 and an `@/*` path alias (skip `init` in an existing shadcn app), then the component:

```sh
npx shadcn@latest init --base base --preset nova --yes --no-monorepo
npx shadcn@latest add ourostack/ouro-ui/ouro-base#v1.3.344
npx shadcn@latest add ourostack/ouro-ui/read-receipt#v1.3.344
```

More: [Installing](https://ui.ouroboros.bot/docs/installing.md).

```tsx
import { ReadReceipt } from "@/components/ouro/read-receipt/read-receipt";
```

## Example

```tsx
<Message role="user" name="You" footer={<ReadReceipt readers={seenHere.map((person) => ({ name: person.name, src: person.photoUrl }))} />}>
  On my way.
</Message>
```

## Usage

Pass it to `Message`'s `footer`, under the last message each person has seen, so the faces move down as people read.

## Use instead when

- Use `AvatarGroup` instead for who is in something, and `ThreadSummary` for who replied in a thread.

## Props

Type: `ReadReceiptProps`.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  | Layout only: margins (`ms-auto`). Appearance classes warn in development. |
| `label` | `((names: readonly string[]) => string)` | `"Seen by"` the first two names, then the rest's count ("and 2 others") | What screen readers hear, from the readers' names, for other languages. |
| `readers` (required) | `readonly AvatarMember[]` |  | Who has seen the message, not counting its writer, in the order they saw it. The first three show as small faces (16px: their picture, or one initial in their own hue), overlapping, and a "+N" after them counts the rest. With nobody, it renders nothing. |
| `ref` | `Ref<HTMLSpanElement>` |  | Reaches the rendered element. |

## Native attributes

Also accepts the attributes in React's `HTMLAttributes` (`id`, `aria-*`, event handlers), passed to the rendered element, except those named on this page.

## Don't use

These are not props. Passing one fails the type check with the fix in the error, and in development a console message names the fix.

- `max`: Not a prop. It shows a few faces and counts the rest: `<ReadReceipt readers={readers} />`.
- `readBy`: Not a prop. Who has seen it is `readers`: `<ReadReceipt readers={[{ name: "Ana Lind" }]} />`.
- `seenBy`: Not a prop. Who has seen it is `readers`: `<ReadReceipt readers={[{ name: "Ana Lind" }]} />`.

## `className` is for layout only

Pass margins, width and grid placement (`mt-4`, `w-full`, `col-span-2`).

Appearance comes from props, not classes. In development, a class that sets appearance logs one warning per component instance, naming the prop to use instead. A class sets appearance when, after its variants (`hover:`, `sm:`) and any `!` are removed, it starts with `bg-`, `text-`, `border-`, `rounded-`, `shadow-`, `font-`, `ring-`, `from-`, `via-`, `to-`, `fill-` or `stroke-`, or is `border`, `rounded`, `shadow` or `ring`, or has a `dark:` variant. Text wrapping, overflow and table layout classes (`text-wrap`, `text-ellipsis`, `border-collapse`) are layout and do not warn.

Alignment classes (`text-center`) warn too: set alignment on a parent element.

## Types

### `AvatarMember`

One member of a group chat, as Avatar's `members` takes them.

```ts
interface AvatarMember {
  /** The member's name: their initial comes from it, and screen readers hear it in the group's name. */
  name: string;
  /** The member's picture. Until it loads, and if it fails, their initial shows in their hue. */
  src?: string | undefined;
  /** What their hue is picked from, when it should not be `name`, as Avatar's `idForColor`. */
  idForColor?: string | undefined;
  /** The letters to take their initial from, when it should not come from `name`. */
  initials?: string | undefined;
}
```
