# Blazor Button Overview

This article introduces the <a href="https://www.telerik.com/blazor-ui/buttons" target="_blank">Blazor Button component</a>, shows how to start using it, and lists its core features.

Buttons convey user actions and can display text, images and HTML.

The Blazor Button provides a variety of styling options through the [built-in themes](https://www.telerik.com/blazor-ui/documentation/styling-and-themes/overview) and the [button type](https://www.telerik.com/blazor-ui/documentation/components/button/type). It supports [font icons and images](https://www.telerik.com/blazor-ui/documentation/components/button/icons) and fires click [events](https://www.telerik.com/blazor-ui/documentation/components/button/events).

## Creating Blazor Button

1. Use the `<TelerikButton>` tag to add the component to your razor page.

2. Handle the `OnClick` event to respond to the user action.

> caption Basic Blazor Button with `OnClick` event handler

<demo metaUrl="client/button/overview/" height="200"></demo>

## Icons

To visually communicate the purpose of a button, you can add an image, sprite, or font icon. You can choose between a wide range of built-in font icons or use your custom font icons. [Read more about the Blazor Button icons...](https://www.telerik.com/blazor-ui/documentation/components/button/icons)

## Type

To control the submit behavior of the Blazor Button, use the `Type` attribute. Select from the following button types: `Submit`, `Reset`, and `Button`. The component also provides a `Form` parameter, which allows the user to submit a form from an external button. [Read more about the Blazor Button Type...](https://www.telerik.com/blazor-ui/documentation/components/button/type)

## Events

The Blazor Button fires events that you can handle and respond to user actions. [Read more about the Blazor Button events...](https://www.telerik.com/blazor-ui/documentation/components/button/events).

## Disabled State

To prevent user interaction with a Button, disable it. [Read more about the disabled state of the Blazor Button...](https://www.telerik.com/blazor-ui/documentation/components/button/disabled-button).

## Styling

To customize the style and the appearance of the Blazor Button, you can use the [built-in themes](https://www.telerik.com/blazor-ui/documentation/styling-and-themes/overview). Additionally, set the `Class` attribute to implement custom CSS rules or [configure the built-in appearance options](https://www.telerik.com/blazor-ui/documentation/components/button/styling).

> tip To learn more about the appearance, anatomy, and accessibility of the Button, visit the [Progress Design System Kit documentation](https://www.telerik.com/design-system/docs/components/button/)—an information portal offering rich component usage guidelines, descriptions of the available style variables, and globalization support details.

## Button Parameters

The Blazor Button provides various parameters that allow you to configure the component. Also check the [Button's public API](https://www.telerik.com/blazor-ui/documentation/api/telerik.blazor.components.telerikbutton).

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

| Parameter    | Type and Default Value                        | Description                                                                                                                                                          |
| ------------ | --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ButtonType` | `ButtonType` enum <br/> (`ButtonType.Submit`) | The `type` attribute of the Button.                                                                                                                                  |
| `Class`      | `string`                                      | The CSS class that will be rendered on the main wrapping element of the Button (`<button class="k-button>`).                                                         |
| `Enabled`    | `bool` <br/> (`true`)                         | Whether the Button is enabled.                                                                                                                                       |
| `Form`       | `string`                                      | The ID of the associated form. Allows using a submit button outside a form.                                                                                          |
| `Id`         | `string`                                      | The `id` attribute of the Button.                                                                                                                                    |
| `Icon`       | `object`                                      | The [icon rendered in the Button](https://www.telerik.com/blazor-ui/documentation/components/button/icons). Can be set to a predefined Telerik icon or a custom one. |
| `Title`      | `string`                                      | The `title` attribute of the Button.                                                                                                                                 |
| `Visible`    | `bool` <br/> (`true`)                         | Whether the Button is visible.                                                                                                                                       |

## Button Reference and Methods

Add a reference to the component instance to use the [Button methods](https://www.telerik.com/blazor-ui/documentation/api/telerik.blazor.components.telerikbutton). Be aware of the Blazor life cycle if you want to [focus the component on page load](https://www.telerik.com/blazor-ui/documentation/knowledge-base/inputs-set-focus#focus-on-page-load).

| Method       | Description                                                                                                                                                                                                                                                               |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `FocusAsync` | Focuses the Blazor Button component. Always call with `await`. Also check the dedicated KB article about [programmatic input component focusing](https://www.telerik.com/blazor-ui/documentation/knowledge-base/inputs-set-focus), which provides more examples and tips. |

```RAZOR.skip-repl
<TelerikButton @ref="ButtonRef">Hello!</TelerikButton>

@code {
    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        await ButtonRef.FocusAsync();

        await base.OnAfterRenderAsync(firstRender);
    }
}
```

## Next Steps

* [Styling the Blazor Button](https://www.telerik.com/blazor-ui/documentation/components/button/styling)
* [Using Button Icons](https://www.telerik.com/blazor-ui/documentation/components/button/icons)

## See Also

* [Live Demo: Button](https://demos.telerik.com/blazor-ui/button/overview)
* [Events](https://www.telerik.com/blazor-ui/documentation/components/button/events)
* [Type](https://www.telerik.com/blazor-ui/documentation/components/button/type)
* [Button API Reference](https://www.telerik.com/blazor-ui/documentation/api/telerik.blazor.components.telerikbutton)
