Skip to content
caliper ui pro docs

Dictation pill

A microphone button for a chat composer that springs open into a recording pill with cancel, a live waveform, a running time and insert. Inserting shows a moment of transcribing, then the pill folds back and the text arrives.

Pro

When to use

  • Chat and AI composers, note-taking and search fields.
  • Mobile-first forms where speaking is faster than typing.

When not to use

  • Long recordings to keep; use `VoiceRecorder`.
  • Voice conversations; use `VoiceAgent`.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/dictation-pill

Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.

API reference

DictationPill

4 props

Also accepts the native props of its root element and a ref.

PropTypeDefaultDescription
onTranscribe *(audio: Blob | null) => Promise<string>—Turns the recording into text. Gets null when `simulate` is on.
onInsert *(text: string) => void—Receives the text to put in the composer.
simulatebooleanfalseDraws a made-up level instead of asking for the microphone, for demos and tests.
maxSecondsnumber120Stops recording on its own after this many seconds.

Keyboard

Escape
Closes or cancels, then returns focus to where it came from.
Enter
Activates the focused control.

Accessibility

It exposes group, status and alert semantics, with aria-label and aria-hidden kept in step with state. Changes that matter are announced through a live region.

Motion

  • State changes animate with the library's shared durations and curves, so its timing matches every other part.
  • Under reduced motion each change lands on its end state without movement; nothing is hidden or skipped.

Notes for AI

Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.

/docs/components/dictation-pill.md

The index of every part is at /llms.txt.

More in Media