# Blazor ToggleButton Overview

This article provides information about the <a href="https://www.telerik.com/blazor-ui/togglebutton" target="_blank">Blazor ToggleButton component</a> and its core features.

The ToggleButton component can have a selected state, which is the main difference from the [regular Telerik UI for Blazor Button](https://www.telerik.com/blazor-ui/documentation/components/button/overview). The two-state styling depends on the [chosen theme](https://www.telerik.com/blazor-ui/documentation/styling-and-themes/overview). The ToggleButton also provides [events](https://www.telerik.com/blazor-ui/documentation/components/togglebutton/events), [declarative appearance customization](https://www.telerik.com/blazor-ui/documentation/components/togglebutton/appearance) and can nest [icons](https://www.telerik.com/blazor-ui/documentation/components/togglebutton/icons).

## Creating Blazor ToggleButton

1. Use the `<TelerikToggleButton>` tag.
2. Set the `Selected` parameter to a `bool` property. Use two-way binding, or one-way binding with a [`SelectedChanged` handler](https://www.telerik.com/blazor-ui/documentation/components/togglebutton/events#selectedchanged).
3. Handle the [`OnClick` event](https://www.telerik.com/blazor-ui/documentation/components/togglebutton/events#onclick).
4. (optional) Add an [icon](https://www.telerik.com/blazor-ui/documentation/components/togglebutton/icons) or configure the [appearance](https://www.telerik.com/blazor-ui/documentation/components/togglebutton/appearance).

> caption Basic Telerik ToggleButton

<demo metaUrl="client/togglebutton/overview/example-1/" height="320"></demo>

## Events

The Toggle Button exposes events for clicks and selected state changes. Find more in the [Toggle Button Events article](https://www.telerik.com/blazor-ui/documentation/components/togglebutton/events).

## Icons

The Toggle Button provides a built-in way to render [Telerik font icons, custom font icons, images or sprites](https://www.telerik.com/blazor-ui/documentation/components/togglebutton/icons).

## Appearance

The Toggle Button provides several parameters that control its [styling and appearance, including background color, rounded corners and fill](https://www.telerik.com/blazor-ui/documentation/components/togglebutton/appearance).

## ToggleButton Parameters

The following table lists Toggle Button parameters, which are not discussed elsewhere. Check the [ToggleButton API Reference](https://www.telerik.com/blazor-ui/documentation/api/telerik.blazor.components.teleriktogglebutton) for a full list of properties, methods and events.

<style>
    .article table {
        table-layout: auto;
        word-break: normal;
    }
</style>

| Parameter   | Type and Default Value | Description                                                                                                                                                                                                                                                                                                                                            |
| ----------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `AriaLabel` | `string`               | Renders an `aria-label` HTML attribute to the button element.                                                                                                                                                                                                                                                                                          |
| `Class`     | `string`               | Renders additional CSS class to the `<button class="k-button">` element. Use it to apply custom styles or [override the theme](https://www.telerik.com/blazor-ui/documentation/styling-and-themes/override-theme-styles). See [Custom Styling](https://www.telerik.com/blazor-ui/documentation/components/togglebutton/overview#custom-styling) below. |
| `Enabled`   | `bool` <br /> (`true`) | Determines if the button is enabled and accepts clicks.                                                                                                                                                                                                                                                                                                |
| `Id`        | `string`               | Renders an `id` HTML attribute to the button element.                                                                                                                                                                                                                                                                                                  |
| `TabIndex`  | `int`                  | Renders a `tabindex` attribute.                                                                                                                                                                                                                                                                                                                        |
| `Title`     | `string`               | Renders a `title` attribute.                                                                                                                                                                                                                                                                                                                           |

## Custom Styling

It is possible to apply custom styles to the button through its `Class` parameter. You may want to customize the styling based on the `Selected` state.

> caption Set CSS class to the button and change its appearance

<demo metaUrl="client/togglebutton/overview/example-2/" height="320"></demo>

## Next Steps

* [Handle Toggle Button Events](https://www.telerik.com/blazor-ui/documentation/components/togglebutton/events)
* [Enhance the Toggle Button with Icons](https://www.telerik.com/blazor-ui/documentation/components/togglebutton/icons)

## See Also

* [Live Demo: ToggleButton](https://demos.telerik.com/blazor-ui/togglebutton/overview)
* [ToggleButton API Reference](https://www.telerik.com/blazor-ui/documentation/api/telerik.blazor.components.teleriktogglebutton)
