-
Notifications
You must be signed in to change notification settings - Fork 79
docs(SpeechToTextButton): add SpeechToTextButton docs #3076
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
--- | ||
title: Appearance | ||
page_title: SpeechToTextButton Appearance | ||
description: Customize the appearance of the SpeechToTextButton component in Blazor applications. | ||
slug: speechtotextbutton-appearance | ||
tags: blazor, speech recognition, appearance, customization | ||
published: true | ||
position: 2 | ||
--- | ||
|
||
# SpeechToTextButton Appearance | ||
|
||
You can customize the appearance of the `SpeechToTextButton` component by using its built-in parameters and CSS classes. The component supports the same appearance options as the standard Telerik Button. | ||
Tsvetomir-Hr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Size | ||
|
||
You can increase or decrease the size of the button by setting the `Size` parameter to a member of the `Telerik.Blazor.ThemeConstants.Button.Size` class. | ||
|
||
To review all available values for the `Size` parameter, see the [Button Size API Reference](https://docs.telerik.com/blazor-ui/api/Telerik.Blazor.ThemeConstants.Button.Size.html). | ||
|
||
**Example of Setting the Button Size** | ||
|
||
<demo metaUrl="client/speechtotextbutton/size/" height="150"></demo> | ||
|
||
## Fill Mode | ||
|
||
The `FillMode` toggles the background and border of the TelerikSpeechToTextButton. You can set the parameter to a member of the `Telerik.Blazor.ThemeConstants.Button.FillMode` class. | ||
|
||
To review all available values for the `FillMode` parameter, see the [Button FillMode API Reference](https://docs.telerik.com/blazor-ui/api/Telerik.Blazor.ThemeConstants.Button.FillMode.html). | ||
|
||
**Example of Setting the Fill Mode** | ||
|
||
<demo metaUrl="client/speechtotextbutton/fillmode/" height="150"></demo> | ||
|
||
## Theme Color | ||
|
||
The color of the button is controlled through the `ThemeColor` parameter. You can set it to a member of the `Telerik.Blazor.ThemeConstants.Button.ThemeColor` class. | ||
|
||
To review all available values for the `ThemeColor` parameter, see the [Button ThemeColor API Reference](https://docs.telerik.com/blazor-ui/api/Telerik.Blazor.ThemeConstants.Button.ThemeColor.html). | ||
|
||
**Example of Setting the Theme Color** | ||
|
||
<demo metaUrl="client/speechtotextbutton/themecolor/" height="150"></demo> | ||
|
||
## Rounded | ||
|
||
The `Rounded` parameter applies the border-radius CSS rule to the button to achieve curving of the edges. You can set it to a member of the `Telerik.Blazor.ThemeConstants.Button.Rounded` class. | ||
|
||
To review all available values for the `Rounded` parameter, see the [Button Rounded API Reference](https://docs.telerik.com/blazor-ui/api/Telerik.Blazor.ThemeConstants.Button.Rounded.html). | ||
|
||
**Example of Setting the Rounded Parameter** | ||
|
||
<demo metaUrl="client/speechtotextbutton/rounded/" height="150"></demo> | ||
|
||
## Icon | ||
|
||
Set the `Icon` parameter to display an icon. You can use a predefined Telerik icon or a custom one. | ||
Tsvetomir-Hr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
**Example of Customizing the Icon** | ||
|
||
<demo metaUrl="client/speechtotextbutton/icon/" height="150"></demo> | ||
|
||
## Custom Styles | ||
|
||
Use the `Class` parameter to apply custom CSS classes. You can further style the button by targeting these classes. | ||
|
||
**Example of Custom Styling** | ||
|
||
<demo metaUrl="client/speechtotextbutton/customstyle/" height="150"></demo> | ||
|
||
## See Also | ||
|
||
- [SpeechToTextButton Overview](slug:speechtotextbutton-overview) | ||
- [SpeechToTextButton Events](slug:speechtotextbutton-events) | ||
- [SpeechToTextButton Integration](slug:speechtotextbutton-integration) |
Tsvetomir-Hr marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
title: Events | ||
page_title: SpeechToTextButton Events | ||
description: Learn about the events that the SpeechToTextButton component emits and how to handle them in Blazor applications. | ||
slug: speechtotextbutton-events | ||
tags: blazor, speech recognition, events | ||
published: true | ||
position: 3 | ||
--- | ||
|
||
# SpeechToTextButton Events | ||
|
||
The `SpeechToTextButton` component emits events that notify you about speech recognition results, errors, and state changes. Use these events to update the UI, display messages, or process the recognized speech. | ||
|
||
## OnResult | ||
|
||
The `OnResult` event fires when the component recognizes speech and produces a result. Use this event to access the recognized phrases, alternatives, and confidence scores. | ||
|
||
To review all available properties of the event arguments for `OnResult`, see the [`SpeechToTextButtonResultEventArgs` API Reference](https://docs.telerik.com/blazor-ui/api/Telerik.Blazor.Components.SpeechToTextButtonResultEventArgs.html). | ||
|
||
**Example: Displaying Recognized Alternatives and Confidence** | ||
|
||
<demo metaUrl="client/speechtotextbutton/onresult/" height="300"></demo> | ||
|
||
## OnStart and OnEnd | ||
|
||
The `OnStart` event fires when speech recognition starts. The `OnEnd` event fires when speech recognition ends. Use these events to update the UI or track the recognition state. | ||
|
||
**Example: Indicating Listening State** | ||
|
||
<demo metaUrl="client/speechtotextbutton/onstartend/" height="300"></demo> | ||
|
||
## OnError | ||
|
||
The `OnError` event fires when an error occurs during speech recognition. Use this event to display error messages to the user. | ||
|
||
## OnClick | ||
|
||
The `OnClick` event fires when the user clicks or taps the button. It receives argument of type `MouseEventArgs`. | ||
|
||
## See Also | ||
|
||
- [SpeechToTextButton Overview](slug:speechtotextbutton-overview) | ||
- [SpeechToTextButton Appearance](slug:speechtotextbutton-appearance) | ||
- [SpeechToTextButton Integration](slug:speechtotextbutton-integration) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
title: Integration | ||
page_title: Integration | ||
description: Learn how to integrate the SpeechToTextButton component with forms and other components in Blazor applications. | ||
slug: speechtotextbutton-integration | ||
tags: blazor, speech recognition, integration | ||
published: true | ||
position: 4 | ||
--- | ||
|
||
# SpeechToTextButton Integration | ||
|
||
Integrate the `SpeechToTextButton` component with forms, input fields, and other UI elements to provide voice input capabilities. | ||
Tsvetomir-Hr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Binding Recognized Text to an Input Field | ||
|
||
Use the `OnResult` event to update an input field with the recognized text. | ||
|
||
**Example of Binding Recognized Text to an TelerikTextArea** | ||
Tsvetomir-Hr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
<demo metaUrl="client/speechtotextbutton/integration/" height="250"></demo> | ||
|
||
|
||
## See Also | ||
|
||
- [AI Model Voice Transcription Intergration](https://github.com/telerik/blazor-ui/tree/master/common/microsoft-extensions-ai-integration/SpeechToTextIntegration) | ||
- [SpeechToTextButton Overview](slug:speechtotextbutton-overview) | ||
- [SpeechToTextButton Events](slug:speechtotextbutton-events) | ||
- [SpeechToTextButton Appearance](slug:speechtotextbutton-appearance) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
title: Overview | ||
page_title: SpeechToTextButton Overview | ||
description: Learn about the SpeechToTextButton component, its features, and how to use it in Blazor applications. | ||
slug: speechtotextbutton-overview | ||
tags: blazor, speech recognition, button, voice input | ||
published: true | ||
position: 1 | ||
--- | ||
|
||
# Blazor SpeechToTextButton Overview | ||
|
||
The `SpeechToTextButton` component enables speech recognition in Blazor applications. It provides a button that users can select to start and stop speech recognition. The component converts spoken words into text and emits events with the recognized results. | ||
Tsvetomir-Hr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Use the `SpeechToTextButton` component to add voice input capabilities to forms, search bars, chat interfaces, and other scenarios that require speech-to-text functionality. | ||
|
||
## Basic Usage | ||
|
||
The following example demonstrates how to add the `SpeechToTextButton` to a Blazor page and handle the recognition result. | ||
|
||
**Example of Using the SpeechToTextButton** | ||
Tsvetomir-Hr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
<demo metaUrl="client/speechtotextbutton/overview/" height="200"></demo> | ||
|
||
## Appearance | ||
|
||
You can customize the appearance of the `SpeechToTextButton` by setting parameters such as `Icon`, and `Class`. For more details and examples, refer to [SpeechToTextButton Appearance](slug:speechtotextbutton-appearance). | ||
|
||
## Events | ||
|
||
The `SpeechToTextButton` component emits several events that you can handle. For more details, refer to [SpeechToTextButton Events](slug:speechtotextbutton-events). | ||
|
||
## SpeechToTextButton Parameters | ||
Tsvetomir-Hr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
To review all available parameters for the `SpeechToTextButton` component, see the [SpeechToTextButton API Reference](https://docs.telerik.com/blazor-ui/api/Telerik.Blazor.Components.TelerikSpeechToTextButton#parameters). | ||
|
||
## SpeechToTextButton Reference and Methods | ||
|
||
The `SpeechToTextButton` component exposes several public methods that you can call from your code. For a full list and details, see the [SpeechToTextButton API Reference](https://docs.telerik.com/blazor-ui/api/Telerik.Blazor.Components.TelerikSpeechToTextButton#methods). | ||
|
||
**Example of Calling a Method by Reference** | ||
Tsvetomir-Hr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
<div class="skip-repl"></div> | ||
````RAZOR | ||
<TelerikSpeechToTextButton @ref="speechToTextButtonRef" /> | ||
|
||
@code { | ||
private async Task StartRecognition() | ||
{ | ||
await speechToTextButtonRef.StartAsync(); | ||
} | ||
} | ||
```` | ||
|
||
## Supported Browsers | ||
|
||
The `SpeechToTextButton` component relies on the Web Speech API. For a list of supported browsers, refer to the [Web Speech API documentation](https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API#browser_compatibility). | ||
|
||
## Next Steps | ||
|
||
* [Handle SpeechToTextButton Events](slug:speechtotextbutton-events) | ||
* [SpeechToTextButton Integration](slug:speechtotextbutton-integration) | ||
|
||
## See Also | ||
|
||
- [SpeechToTextButton Live Demo](https://demos.telerik.com/blazor-ui/speechtotextbutton/overview) | ||
- [SpeechToTextButton API Reference](/blazor-ui/api/Telerik.Blazor.Components.TelerikSpeechToTextButton) | ||
- [SpeechToTextButton Events](slug:speechtotextbutton-events) | ||
- [SpeechToTextButton Appearance](slug:speechtotextbutton-appearance) | ||
Tsvetomir-Hr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- [SpeechToTextButton Integration](slug:speechtotextbutton-integration) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.