Voice Input
ProNewA microphone button that opens into a recording pill with a live, scrolling waveform.
Installation
pnpm dlx shadcn@latest add @viewport/voice-input
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| onStart | () => voidCalled when recording begins. | — |
| onStop | (seconds: number) => voidCalled with the length of the recording in seconds. | — |
| simulate | booleanDraw a synthetic waveform instead of asking for the microphone. Also the fallback when access is denied. | false |
| bars | numberNumber of bars in the waveform. | 28 |
| className | string | — |
Accessibility
- Start and stop are labelled buttons; stop reads out the time so far, and focus moves between them.
- Recording is announced through a status region.
- Falls back to a synthetic signal when the microphone is unavailable.