View as Markdown

API reference: @salmonui/inputs/speech-to-text

SpeechToTextButtonPropsinterface

import type { SpeechToTextButtonProps } from '@salmonui/inputs/speech-to-text';
interface SpeechToTextButtonProps extends OwnButtonProps, UseSpeechRecognitionOptions {
    readonly children?: ButtonBaseProps['children'];
    readonly localeText?: SpeechToTextLocaleText | undefined;
}
SpeechToTextButtonProps members (18, 16 inherited)
NameSignatureDescription
childrenoptionalreadonly children?: ButtonBaseProps['children'];

Visible label; without children the button is icon-only, named by localeText.label.

localeTextoptionalreadonly localeText?: SpeechToTextLocaleText | undefined;
variantoptionalinheritedvariant?: ButtonVariant;

Visual weight. Default 'solid' (or the group's).

toneoptionalinheritedtone?: ButtonTone;

Color role. Default 'neutral'; 'primary' for a floating button (or the group's).

sizeoptionalinheritedsize?: ButtonSize;

Metric set. Default 'md' (or the group's).

iconStartoptionalinheritediconStart?: ReactNode;

Decorative icon before the label (inline-start; follows dir).

iconEndoptionalinheritediconEnd?: ReactNode;

Decorative icon after the label (inline-end; follows dir).

floatingoptionalinheritedfloating?: boolean | ButtonFloatingPosition;

Floating action button: circular, elevated, positioned by CSS.

floatingScopeoptionalinheritedfloatingScope?: "parent" | "viewport";

'viewport' (default, position: fixed) or 'parent' (position: absolute in the nearest positioned ancestor).

refoptionalinheritedref?: Ref<HTMLButtonElement>;

The <button> (or the element render returns).

langoptionalinheritedlang?: string;

BCP 47 recognition language. Default: document.documentElement.lang, read when a session starts.

interimResultsoptionalinheritedinterimResults?: boolean;

Deliver interim (non-final) results. Default true.

continuousoptionalinheritedcontinuous?: boolean;

Keep listening after a pause until stop(). Default true.

recognizeroptionalinheritedrecognizer?: (() => SpeechRecognizer);

Replaces the browser recognizer, e.g. a cloud service. Called once per session.

onTranscriptChangeoptionalinheritedonTranscriptChange?: ((transcript: string, details: SpeechTranscriptDetails) => void);

The session transcript changed.

onStartoptionalinheritedonStart?: (() => void);

The recognizer started capturing audio.

onStopoptionalinheritedonStop?: (() => void);

The session ended (stop(), abort(), an error or the recognizer).

onErroroptionalinheritedonError?: ((error: SpeechRecognitionError) => void);

A recognizer error, or 'unsupported' when start() has no recognizer.