Components

Typing indicator

"Somebody is writing": a small pencil that draws three dots one after another, or scrawls a line of cursive. A polite live region with a screen-reader label, at home inside a bubble.

Install

terminal
npx shadcn@latest add @wobko/typing-indicator

First time here? Add the registry to components.json first. How to install

Examples

Three dots and a scrawl

The pencil writes the dots one after another, walks back and starts again. The second variant scrawls a line of cursive instead.

Inside a bubble

Put it in a BubbleContent and the bubble draws itself round it. Keep the region mounted and exposed (hide the bubble with sr-only, never display: none) and toggle `active`, so assistive tech announces it.

Who is typing

A message row with an avatar, a header and the indicator in blue felt for the person on the other end. The label names them for screen readers.

API reference

TypingIndicator

A `role="status"` region 56 x 24 px (80 x 24 for the scrawl) holding the drawing and a visually hidden label. Every CSS animation ends on the fully drawn frame, so reduced motion shows the dots, the line and the pencil at rest.

PropTypeDefaultDescription
variant"dots" | "squiggle""dots"Three dots, or a line of cursive scrawl.
pen"ink" | "you""ink"`you` writes in blue felt.
pencilbooleantrueDraw the pencil that does the writing.
activebooleantrueFalse leaves an empty live region mounted, so a screen reader announces the label when it turns on.
labelstring"Typing"What assistive technology announces.
seedstring | number-Pins the hand.

Accessibility

  • `role="status"` with `aria-live="polite"`: it never interrupts. The label is visually hidden text; the drawing is an aria-hidden svg.
  • A live region announces changes, not arrivals: keep the indicator mounted and toggle `active` (the examples do) instead of mounting it when someone starts typing. Keep it exposed too: `hidden`, `display: none` or `visibility: hidden` on an ancestor removes the region from the accessibility tree, so collapse the bubble around it with `sr-only`.
  • The animation is decoration. With `prefers-reduced-motion` (or the app's calm setting) every animation ends on its last frame, which is the complete drawing; nothing blinks or loops.
  • Ink on paper is 14:1 (blue felt 7.1:1); the marks are not the only carrier of meaning, the label is.

Source

The files the CLI copies into your project.

Loading the source