Typing dots

Slant / People & chat

Three pixels that pulse while someone is typing.

Demo

Usage

@tuttn/slant
import { TypingDots } from '@tuttn/slant'

// With a label it is an image with that name; without one it is decoration.
<TypingDots label="The assistant is typing" />
<TypingDots />

// It draws in the current text colour.
<span style={{ color: 'var(--sl-accent)' }}><TypingDots /></span>

// Three components draw it for you.
<Message author="assistant" typing />
<Chip tone="accent" indicator="dots">Working</Chip>
<Button loading>Saving</Button>

Props

PropTypeDefaultDescription
labelstring—Announced to screen readers as an image; without it the dots are decorative.
…restHTMLAttributes—className, style, the ref and other attributes reach the root <span>.

Accessibility

  • With label the dots are role="img" with that name. Without it they are aria-hidden, so say what is happening in text nearby.
  • They are not a live region, so showing them announces nothing. Put them inside one if they should be heard: a Thread is a polite live log.
  • When the reader prefers reduced motion they stop pulsing and rest as three still pixels.
  • Inside a loading Button they are decorative; the button says it is busy with aria-busy.