This version of the Speechly documentation is no longer actively maintained. For up-to-date documentation, see the latest version.

Voice Input

Voice Input is a voice-enabled text field component. Its value changes whenever the specified entity type is found in the SpeechSegment. The new value will be the entity’s value.

Preview

Voice Input

Voice Input dressed in capsule and mui themes. See styling the components for more information.

Usage

You’ll need a Speechly React app and a Speechly configuration that tags entities in phrases to use this component.

Ensure you have added the @speechly/react-voice-forms dependency:

npm i @speechly/react-voice-forms

Import the component and a css theme:

import { VoiceInput } from '@speechly/react-voice-forms'
import '@speechly/react-voice-forms/css/theme/mui.css'

Place the form component somewhere inside your SpeechProvider block:

<SpeechProvider appId="YOUR_APP_ID_FROM_SPEECHLY_DASHBOARD">
  <VoiceInput label="From" changeOnEntityType="from" />
</SpeechProvider>

Properties

NameTypeDescription
labelstringThe label displayed on the component. For speech use, the label should match the keywords in the phrase used to control the widget: e.g. component with label “Passengers” should be configured to react to phrases like “3 passegers”
changeOnEntityTypestringstring (entity type) specifies the entity type that changes this component’s value. The new value will be the entity’s value.
value?stringThe current value. Specifying the value controls the components’s state so it makes sense to provide an onChange handler.
defaultValue?stringInitial value. Has no effect if value is specified.
changeOnIntent?stringstring (intent) filters out all but the specified intent. undefined disables intent filtering.
onChange?(value: string) => void

Last updated by Mathias Lindholm on January 26, 2022 at 11:48 +0200

Found an error on our documentation? Please file an issue or make a pull request