# SpeechToTextButton Programmatic Control

The KendoReact SpeechToTextButton exposes methods that let you control speech recognition from your application code through the component [`ref`](https://www.telerik.com/kendo-react-ui/components/buttons/api/speechtotextbuttonhandle). These methods allow you to start, stop, abort, and check the status of speech recognition operations from your application code.

To control speech recognition programmatically, create a ref with the `SpeechToTextButtonHandle` type, pass it to the SpeechToTextButton, and call the methods from your own controls.

```tsx
const sttButtonRef = React.useRef<SpeechToTextButtonHandle | null>(null);

<SpeechToTextButton ref={sttButtonRef} />;
<Button onClick={() => sttButtonRef.current?.start()}>Start Recognition</Button>;
```

The following example demonstrates how to create a `ref` for the SpeechToTextButton and use it to invoke the [`start()`](https://www.telerik.com/kendo-react-ui/components/buttons/api/speechtotextbuttonhandle#start), [`stop()`](https://www.telerik.com/kendo-react-ui/components/buttons/api/speechtotextbuttonhandle#stop), [`abort()`](https://www.telerik.com/kendo-react-ui/components/buttons/api/speechtotextbuttonhandle#abort), and [`isActive()`](https://www.telerik.com/kendo-react-ui/components/buttons/api/speechtotextbuttonhandle#isactive) methods.

[Demo Source](https://demos.telerik.com/kendo-react-ui/buttons/speechtotextbutton/using-ref/source.txt)

## Suggested Links

* [SpeechToTextButton API Reference](https://www.telerik.com/kendo-react-ui/components/buttons/api/speechtotextbuttonprops)
* [SpeechToTextButton Events](https://www.telerik.com/kendo-react-ui/components/buttons/speechtotextbutton/events)
* [SpeechToTextButton Integration](https://www.telerik.com/kendo-react-ui/components/buttons/speechtotextbutton/integration)
* [SpeechToTextButton Configuration Options](https://www.telerik.com/kendo-react-ui/components/buttons/speechtotextbutton/speech-configs)
