/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2026 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import { ButtonProps } from '../../Button.js'; /** * @hidden */ type Omit = Pick>; /** * Represents a single recognition alternative from the speech engine. */ export interface SpeechRecognitionAlternative { /** * The transcript of the recognized speech. */ transcript: string; /** * A confidence score for the transcript, where 0 indicates no confidence and 1 indicates complete confidence. */ confidence: number; } /** * The event argument for the `result` event of the SpeechToTextButton. */ export interface SpeechToTextResultEvent { /** * Indicates whether the speech recognition result is final (`true`) or interim (`false`). */ isFinal: boolean; /** * An array of possible recognition alternatives returned by the speech engine. */ alternatives: SpeechRecognitionAlternative[]; } /** * The event argument for the `error` event of the SpeechToTextButton. */ export interface SpeechToTextErrorEvent { /** * Message detailing the cause of the speech recognition error. Use this message for debugging or user feedback. */ errorMessage: string; } /** * Represents the props of the [KendoReact SpeechToTextButton component](https://www.telerik.com/kendo-react-ui/components/buttons/speechtotextbutton). */ export interface SpeechToTextButtonProps extends Omit { /** * The valid BCP 47 language tag to use for speech recognition. * * @default 'en-US' */ lang?: string; /** * Specifies whether the speech recognition should continue until explicitly stopped. * * @default false */ continuous?: boolean; /** * Specifies whether to return interim results. * * @default false */ interimResults?: boolean; /** * Specifies the maximum number of alternative transcriptions to return. * * @default 1 */ maxAlternatives?: number; /** * Specifies which speech recognition engine or integration the component should use. * This allows the component to operate in different environments or use alternative implementations. */ integrationMode?: 'webSpeech' | 'none'; /** * The accessible label of the component. * * @remarks * This property is related to accessibility. */ ariaLabel?: string; /** * Specifies if the SpeechToTextButton is disabled ([see example](https://www.telerik.com/kendo-react-ui/components/buttons/speechtotextbutton/disabled-state)). * * @default false */ disabled?: boolean; /** * Sets additional classes to the SpeechToTextButton ([see example](https://www.telerik.com/kendo-react-ui/components/buttons/speechtotextbutton/appearance#custom-styling)). */ className?: string; /** * Sets additional CSS styles to the SpeechToTextButton ([see example](https://www.telerik.com/kendo-react-ui/components/buttons/speechtotextbutton/appearance#custom-styling)). */ style?: React.CSSProperties; /** * Callback function that is called when speech recognition starts. */ onStart?: () => void; /** * Callback function that is called when a speech recognition result is available. * The event contains the `isFinal` flag and an array of alternatives. */ onResult?: (event: SpeechToTextResultEvent) => void; /** * Callback function that is called when speech recognition ends. */ onEnd?: () => void; /** * Callback function that is called when an error occurs during speech recognition. */ onError?: (event: SpeechToTextErrorEvent) => void; } export {};