Skip to main content

Chat

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.

You
Yes, ten sharp.
Seen by Grace Hopper and Katherine Johnson
You
Bring the engine notes.
Seen by Ana Lind, Alan Turing and 2 others

Install

Hand it to your agent
Add ReadReceipt from Ouro UI to this app. Read https://ui.ouroboros.bot/docs/read-receipt.md first and follow it.

Or by hand. Once per app, with Tailwind CSS v4 and an @/* path alias (Ouro HX is built on Base UI, so --base base; skip -t in an existing app):

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

Then the component. From v0.8.0 it installs only the helpers it imports and never touches your stylesheet (Installing):

npx shadcn@latest add ourostack/ouro-ui/read-receipt#v1.3.344

Or, with the @ouro namespace set up:

npx shadcn@latest add @ouro/ouro-base @ouro/read-receipt

Its tests, stories and Playwright spec are optional. They need Vitest 4.1.11 or later, and from v0.8.0 never change a version your app has (Testing):

npx shadcn@latest add ourostack/ouro-ui/read-receipt#v1.3.344 ourostack/ouro-ui/read-receipt-tests#v1.3.344
import { ReadReceipt } from "@/components/ouro/read-receipt/read-receipt";

Paths use shadcn's default @/ alias; the CLI rewrites them to yours.

Example

<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.

className
Type: string
Layout only: margins (ms-auto). Appearance classes warn in development.
label
Type: ((names: readonly string[]) => string)
Default: "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)
Type: 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
Type: 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.

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;
}