Skip to main content

Chat

TypingIndicator

The line under a chat that says who is writing: their faces, pulsing dots and "Ned Land is writing…". It is a polite status region, so screen readers hear the words once each time the writers change, and the faces and dots are hidden from them. The dots only fade, so reduced motion keeps them.

Who is writing
Ned Land is writing…

On this site

This site's own pages use TypingIndicator too. Open one with X-ray pointing it out: The Nautilus's story

Install

Hand it to your agent
Add TypingIndicator from Ouro UI to this app. Read https://ui.ouroboros.bot/docs/typing-indicator.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/typing-indicator#v1.3.344

Or, with the @ouro namespace set up:

npx shadcn@latest add @ouro/ouro-base @ouro/typing-indicator

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/typing-indicator#v1.3.344 ourostack/ouro-ui/typing-indicator-tests#v1.3.344
import { TypingIndicator } from "@/components/ouro/typing-indicator/typing-indicator";

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

Example

<TypingIndicator people={writers.map((person) => ({ name: person.name, src: person.photoUrl }))} />

Usage

Put it between a MessageList and its Composer.

Use instead when

  • Use Message's streaming instead for a reply that is already on its way in the chat, such as an AI agent's, and AgentPresence for what an agent is doing.

Props

Type: TypingIndicatorProps.

className
Type: string
Layout only: margins and padding (px-4). Appearance classes warn in development.
label
Type: ((names: readonly string[]) => string)
Default: one name "is writing…", two "are writing…", then "Several people are writing…"
The words, from the writers' names, for other languages. It is not called when nobody is writing.
people (required)
Type: readonly AvatarMember[]
Who is writing now, not counting the reader, in the order they started. Each of the first three shows as a small face (their picture, or one initial in their own hue) beside pulsing dots and the words: "Ned Land is writing…", "Ned Land and Conseil are writing…", then "Several people are writing…". Pass an empty list when nobody is: the line stays, one line tall and empty, so the chat above it never moves.
ref
Type: Ref<HTMLDivElement>
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.

  • typing: Not a prop. Who is writing is people: <TypingIndicator people={[{ name: "Ned Land" }]} />.
  • users: Not a prop. Who is writing is people: <TypingIndicator people={[{ name: "Ned Land" }]} />.
  • visible: Not a prop. It shows while people has anyone in it: <TypingIndicator people={writers} />.

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