Skip to main content
The @corti/dictation-web package provides a set of custom elements that handle microphone management, audio streaming, transcript display, and voice commands on top of the Corti API. It works with any frontend framework or plain HTML. The library provides two usage modes:
  1. <corti-dictation> — opinionated, all-in-one component with built-in UI (recommended for most use cases)
  2. Modular components — individual building blocks (<dictation-root>, <dictation-recording-button>, etc.) for fully custom layouts
Looking for multi-speaker ambient streaming? See the Ambient Web Component.
OAuth 2.0 authentication is not handled by this library. The client must provide an authorization token or token refresh function while using the component.

Installation

Module import

Quick start

The component handles microphone permissions, device selection, and audio streaming automatically. You only need to provide authentication and listen for events.

Configuration

Set dictationConfig as a JavaScript property to configure the transcription engine. The type matches the config message from the Transcribe WebSocket API.
See the Transcribe API Reference for the full configuration schema.

Modular components

For custom UI layouts, use individual components inside a <dictation-root> parent:
All modular components require a <dictation-root> parent to provide context. They cannot be used standalone.
ComponentDescription
<dictation-root>Context provider. Same properties as <corti-dictation> (auth, config, devices, keybindings). Add noWrapper attribute to remove default styling.
<dictation-recording-button>Start/stop button with audio visualization. Supports allowButtonFocus. Has startRecording(), stopRecording(), toggleRecording(), openConnection(), closeConnection() methods.
<dictation-settings-menu>Settings panel with device and language selectors. Supports settingsEnabled.
<dictation-device-selector>Standalone device dropdown. Supports disabled.
<dictation-language-selector>Standalone language dropdown. Supports disabled.
<dictation-keybinding-selector>Keybinding configuration. Supports keybindingType ("push-to-talk" or "toggle-to-talk") and disabled.
See the API Reference for full per-component property and method tables.

Keyboard shortcuts

The component supports two keybinding modes:
ModeBehaviorDefault key
Push-to-talkHold key to record, release to stopSpace
Toggle-to-talkPress to start, press again to stopEnter
Configure via attributes:
Keys are specified as event.key names (e.g. "Space", "k", "Meta") or event.code values (e.g. "KeyK", "Backquote"). Modifier combinations are not supported.
When both keybindings are set to the same key, toggle-to-talk takes priority.

Preventing keybinding activation

Use the keybinding-activated event to conditionally block keybindings:

Voice commands

Voice commands let users control your application by speaking phrases. Configure commands via dictationConfig.commands — each command has a phrases pattern and optional variables. The component emits a command event when a phrase is matched. See the Transcribe API reference for the full command schema.

Attribute formatting

TypeFormatExample
BooleanPresence = true, absence = false<corti-dictation debug-display-audio>
StringAttribute valueaccessToken="token"
ArrayComma-separatedsettingsEnabled="device,language"
ObjectJavaScript property onlydictation.authConfig = { ... }

Resources


For support or questions, contact us