Skip to content
Haze UI

AI voice input

Minimal floating voice capture control with circular record toggle, tabular timer, 48-tick waveform rail and playback review controls.

pnpm dlx shadcn@latest add @haze/ai-voice
Open preview in a new tab
Livesmall script

When to use

  • Capturing short spoken prompts or voice memos inside an AI assistant card
  • Letting users review, play back, discard or send a recorded clip before transcription
  • Demonstrating a calm voice input workflow that degrades cleanly under reduced motion

When not to use

  • Users primarily type long structured prompts with files and slash commands; use ai-prompt instead

Installation

Add the Haze registry to components.json once, then install AI voice input with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/ai-voice
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
idstring"haze-ai-voice"Unique prefix for the section heading reference.
headingstring"AI voice input"Heading displayed at the top of the voice capture card.
sampleTranscriptstring"Remind the platform team to rotate staging webhook keys before Friday's deploy window."Demo transcript rendered in the sent voice note chip.
maxDurationSecondsnumber60Maximum recording duration in seconds before auto-stopping to review.
classstring–Extra classes on the outer section.

Keyboard interactions

SpaceEnter
Start or stop recording, toggle playback review, discard or send the voice note
Tab
Move between the record button, review toolbar actions and sent transcript dismiss button

Accessibility

  • The microphone button updates aria-label and aria-pressed as capture moves from idle to recording to review.
  • Waveform animation stops under prefers-reduced-motion while preserving static bar levels, timer updates and polite role="status" announcements.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • Install and use

    Install the Haze UI block "AI voice input" with `npx shadcn@latest add @haze/ai-voice`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import AiVoice from "@/components/haze/blocks/ai-voice.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/blocks/ai-voice.md

  • Customize with real content

    Adapt the Haze ai-voice block for our product. Replace the demo values of these props with our real content: id, heading, sampleTranscript, maxDurationSeconds, class. Keep the layout, the heading level rules and these accessibility details: The microphone button updates aria-label and aria-pressed as capture moves from idle to recording to review. Waveform animation stops under prefers-reduced-motion while preserving static bar levels, timer updates and polite role="status" announcements. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using ai-voice, check it fits: use it when capturing short spoken prompts or voice memos inside an ai assistant card; letting users review, play back, discard or send a recorded clip before transcription; demonstrating a calm voice input workflow that degrades cleanly under reduced motion. Avoid it when users primarily type long structured prompts with files and slash commands; use ai-prompt instead. Alternatives: @haze/ai-prompt, @haze/ai-composer.

Dependencies

  • npm: @lucide/astro
  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog