Skip to content

AiVoiceTrigger

An intelligent voice interaction component that provides a sleek, float-over experience and supports custom audio waveform tracking to showcase multi-modal feedback.

Basic Usage

The simplest way is using v-model:recording to directly bind the recording state. Clicking on the mic triggers the visualizer panel.

State: Idle
Basic Usage

Dynamic Amplitudes Bar

Pass an array to amplitudes property dynamically during recording loop to visualize biometric traits or simulated multi-modal input. (Ideally bound to Web Audio API outputs)

Real-time Audio Simulation

Capturing Events

Listening to @start, @stop and @cancel can help you bridge the component exactly to your core WebSocket streaming API without data leakages. Text inside default slot will also append directly.

Please open Developer Tool (F12) to inspect the logs
Trigger Callbacks

Practical Scenario: Voice Assistant

By combining the AiVoiceTrigger and AiBubble components, we can easily build a smart voice assistant interface featuring voice input, loading states, and responsive chat bubbles.

Hello! I am your voice assistant. Click the microphone below to talk to me.

Application Scenario

API

Props

AttributeDescriptionTypeDefault
recording / v-model:recordingWhether the voice trigger is active.booleanfalse
amplitudesReal-time array determining the visualizer bars.number[][5,5,5,...]
theme-overridesFine-grained theme overridesComponentThemeVars

Events

Event NameDescriptionParameters
update:recordingEmits state update back to model.(value: boolean)
startTriggered when active recording initiated.
stopTriggered when users press the recording button again to submit.
cancelUsers explicitly hit the dismiss key to discard audio chunk.

Slots

Slot NameDescriptionParameters
defaultPlaceholder label text accompanying the minimal mic dot

Use in Nuxt

This component fully supports Nuxt 3/4. In Nuxt projects, the component will be automatically imported.

For detailed configuration, please see Nuxt Integration.

Theme Variables

Variable NameDescriptionDefault Value
--yh-ai-voice-trigger-btn-sizeTrigger button size32px
--yh-ai-voice-trigger-active-colorActive color during recordingvar(--yh-color-danger)
--yh-ai-voice-trigger-wave-colorWaveform colorvar(--yh-color-danger)
--yh-ai-voice-trigger-bgPanel background colorvar(--yh-bg-color-overlay)

Released under the MIT License.