Skip to content

Chat Dictation Button

@astryxdesign/core v0.7.1 · ChatDictationButton

Click the microphone to start dictating. Speech is transcribed into the input.

Usage ​

ChatDictationButton is a toggle button that starts and stops voice dictation inside a chat composer. It pairs with useChatDictation to show a microphone icon when idle and animated frequency bars when listening. Place it in the sendActions slot of ChatComposer.

ts
import { ChatDictationButton } from '@astryx-vue/core/Chat'

Anatomy

ElementDescription
Microphone iconShown in the idle state. Indicates that tapping will start voice input.
Frequency barsAnimated equalizer bars that replace the icon during listening. React to real microphone volume.
Ghost buttonThe underlying Button with ghost variant and isIconOnly, providing the hit target and focus ring.

Best practices ​

GuidancePractices
DoPlace the dictation button in the sendActions slot of ChatComposer so it sits next to the send button where users expect voice input controls.
DoPass the input handle to useChatDictation so interim transcripts appear as ghost text in the composer input while the user speaks.
DoEnable hasSounds on useChatDictation to give users audio feedback when dictation starts and stops. This is especially helpful when the button's visual change is subtle.
Don'tDon't use the dictation button outside a chat composer context. It's designed for the composer's send-action layout, not as a standalone recording control.
Don'tDon't forget to handle the unsupported case. The button hides itself by default when the browser lacks SpeechRecognition, but you should still design the composer to work without it.

Examples ​

Common configurations, variations, and states.

ChatDictationButton — Basic

A dictation button wired to useChatDictation and placed in the sendActions slot of a ChatComposer. Click the microphone to transcribe speech into the input.