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

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

## 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/typing-indicator#v1.3.344
```

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

```tsx
import { TypingIndicator } from "@/components/ouro/typing-indicator/typing-indicator";
```

## Example

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

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  | Layout only: margins and padding (`px-4`). Appearance classes warn in development. |
| `label` | `((names: readonly string[]) => string)` | 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) | `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` | `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.

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