API reference
@salmonui/inputs/speech-to-text
15 exported symbols: 2 functions, 10 interfaces, 2 types and 1 constant. Each name links its page with the signature, docs and members.
import { … } from '@salmonui/inputs/speech-to-text';Functions
SpeechToTextButtonToggle button that starts and stops speech recognition: Button with aria-pressed while listening. The name stays constant; the state hint is the accessible des…useSpeechRecognitionSpeech recognition over the Web Speech API or a replaceable recognizer. Options are read when events happen, so callbacks may be inline functions.
Interfaces
SpeechRecognitionApiSpeechRecognitionErrorSpeechRecognizerThe subset of the Web Speech SpeechRecognition interface the hook uses. A cloud recognizer implements it; one instance per session.SpeechRecognizerAlternativeOne alternative of a result (Web Speech SpeechRecognitionAlternative).SpeechRecognizerResultOne result (Web Speech SpeechRecognitionResult): alternatives, best first.SpeechRecognizerResultEventresult event (Web Speech SpeechRecognitionEvent): every result of the session so far.SpeechToTextButtonPropsSpeechToTextLocaleTextUser-visible strings of SpeechToTextButton.SpeechTranscriptDetailsSecond argument of onTranscriptChange: final is true when every result of the session is final.UseSpeechRecognitionOptions
Types
SpeechRecognitionErrorCodeA Web Speech SpeechRecognitionErrorEvent.error code, or 'unsupported'.SpeechRecognitionState'idle' before the first session, 'listening' while a session runs, 'stopped' after it ends.