Class RadzenButton
A clickable button component that supports various visual styles, icons, images, and loading states. RadzenButton provides a consistent and accessible way to trigger actions in your Blazor application. Supports multiple visual variants (Filled, Flat, Outlined, Text), color styles (Primary, Secondary, Success, etc.), and sizes (ExtraSmall, Small, Medium, Large). It can display text, icons, images, or a combination of these. When IsBusy is true, the button shows a loading indicator and becomes disabled.
Inheritance
Inherited Members
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
Syntax
public class RadzenButton : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRender, IDisposableExamples
Basic usage with text and click handler:
<RadzenButton Click=@(args => Console.WriteLine("Button clicked")) Text="Click Me" />Button with icon and custom style:
<RadzenButton Icon="save" Text="Save" ButtonStyle="ButtonStyle.Success" Variant="Variant.Flat" Size="ButtonSize.Large" />Button with busy state:
<RadzenButton IsBusy=@isSaving BusyText="Saving..." Text="Save" Click=@SaveData />Constructors
RadzenButton()
A clickable button component that supports various visual styles, icons, images, and loading states. RadzenButton provides a consistent and accessible way to trigger actions in your Blazor application. Supports multiple visual variants (Filled, Flat, Outlined, Text), color styles (Primary, Secondary, Success, etc.), and sizes (ExtraSmall, Small, Medium, Large). It can display text, icons, images, or a combination of these. When IsBusy is true, the button shows a loading indicator and becomes disabled.
Declaration
public RadzenButton()Examples
Basic usage with text and click handler:
<RadzenButton Click=@(args => Console.WriteLine("Button clicked")) Text="Click Me" />Button with icon and custom style:
<RadzenButton Icon="save" Text="Save" ButtonStyle="ButtonStyle.Success" Variant="Variant.Flat" Size="ButtonSize.Large" />Button with busy state:
<RadzenButton IsBusy=@isSaving BusyText="Saving..." Text="Save" Click=@SaveData />Properties
BusyText
Gets or sets the text displayed when the button is in a busy state (IsBusy is true). If not set, the button will show a loading indicator without text.
Declaration
[Parameter]
public string BusyText { get; set; }Property Value
| Type | Description | 
|---|---|
| string | The busy state text. Default is empty string. | 
ButtonStyle
Gets or sets the semantic color style of the button. Determines the button's color scheme based on its purpose (e.g., Primary for main actions, Danger for destructive actions).
Declaration
[Parameter]
public ButtonStyle ButtonStyle { get; set; }Property Value
| Type | Description | 
|---|---|
| ButtonStyle | The button style. Default is Primary. | 
ButtonType
Gets or sets the HTML button type attribute. Use Submit for form submissions or Button for regular clickable buttons.
Declaration
[Parameter]
public ButtonType ButtonType { get; set; }Property Value
| Type | Description | 
|---|---|
| ButtonType | The button type. Default is Button. | 
ChildContent
Gets or sets the custom child content to be rendered inside the button. When set, this content will be displayed instead of the Text, Icon, or Image.
Declaration
[Parameter]
public RenderFragment ChildContent { get; set; }Property Value
| Type | Description | 
|---|---|
| RenderFragment | The child content. | 
Click
Gets or sets the callback invoked when the button is clicked. This event will not fire if the button is Disabled or IsBusy.
Declaration
[Parameter]
public EventCallback<MouseEventArgs> Click { get; set; }Property Value
| Type | Description | 
|---|---|
| EventCallback<MouseEventArgs> | The click event callback. | 
Disabled
Gets or sets whether the button is disabled and cannot be clicked. When true, the button will have a disabled appearance and will not respond to user interactions.
Declaration
[Parameter]
public bool Disabled { get; set; }Property Value
| Type | Description | 
|---|---|
| bool | 
 | 
Icon
Gets or sets the Material icon name to be displayed in the button. Use Material Symbols icon names (e.g., "save", "delete", "add"). The icon will be rendered using the rzi icon font.
Declaration
[Parameter]
public string Icon { get; set; }Property Value
| Type | Description | 
|---|---|
| string | The Material icon name. | 
IconColor
Gets or sets a custom color for the icon. This overrides the default icon color determined by the button's ButtonStyle and Variant. Supports any valid CSS color value (e.g., "#FF0000", "rgb(255, 0, 0)", "var(--my-color)").
Declaration
[Parameter]
public string IconColor { get; set; }Property Value
| Type | Description | 
|---|---|
| string | The icon color as a CSS color value. | 
Image
Gets or sets the URL of an image to be displayed in the button. The image will be rendered as an img element. For icon fonts, use the Icon property instead.
Declaration
[Parameter]
public string Image { get; set; }Property Value
| Type | Description | 
|---|---|
| string | The image URL or path. | 
ImageAlternateText
Gets or sets the alternate text for the button's image. This is used as the alt attribute when an Image is specified, improving accessibility.
Declaration
[Parameter]
public string ImageAlternateText { get; set; }Property Value
| Type | Description | 
|---|---|
| string | The image alternate text. Default is "button". | 
IsBusy
Gets or sets whether the button is in a busy/loading state. When true, the button displays a loading indicator, shows the BusyText, and becomes disabled. This is useful for indicating asynchronous operations are in progress.
Declaration
[Parameter]
public bool IsBusy { get; set; }Property Value
| Type | Description | 
|---|---|
| bool | 
 | 
IsDisabled
Gets a value indicating whether this button is effectively disabled. The button is disabled if either Disabled is true or IsBusy is true.
Declaration
public bool IsDisabled { get; }Property Value
| Type | Description | 
|---|---|
| bool | 
 | 
Shade
Gets or sets the color intensity shade for the button. Works in combination with ButtonStyle to adjust the color darkness/lightness.
Declaration
[Parameter]
public virtual Shade Shade { get; set; }Property Value
| Type | Description | 
|---|---|
| Shade | The color shade. Default is Default. | 
Size
Gets or sets the button size. Controls the padding, font size, and overall dimensions of the button.
Declaration
[Parameter]
public virtual ButtonSize Size { get; set; }Property Value
| Type | Description | 
|---|---|
| ButtonSize | The button size. Default is Medium. | 
TabIndex
Gets or sets the tab index for keyboard navigation. Controls the order in which the button receives focus when the user presses the Tab key.
Declaration
[Parameter]
public int TabIndex { get; set; }Property Value
| Type | Description | 
|---|---|
| int | The tab index. Default value is 0. | 
Text
Gets or sets the text label displayed on the button. If both Text and Icon are set, both will be displayed.
Declaration
[Parameter]
public string Text { get; set; }Property Value
| Type | Description | 
|---|---|
| string | The button text. Default is empty string. | 
Variant
Gets or sets the design variant that controls the button's visual appearance. Options include Filled (solid background), Flat (subtle background), Outlined (border only), and Text (minimal styling).
Declaration
[Parameter]
public virtual Variant Variant { get; set; }Property Value
| Type | Description | 
|---|---|
| Variant | The button variant. Default is Filled. | 
Methods
BuildRenderTree(RenderTreeBuilder)
A clickable button component that supports various visual styles, icons, images, and loading states. RadzenButton provides a consistent and accessible way to trigger actions in your Blazor application. Supports multiple visual variants (Filled, Flat, Outlined, Text), color styles (Primary, Secondary, Success, etc.), and sizes (ExtraSmall, Small, Medium, Large). It can display text, icons, images, or a combination of these. When IsBusy is true, the button shows a loading indicator and becomes disabled.
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)Parameters
| Type | Name | Description | 
|---|---|---|
| RenderTreeBuilder | __builder | 
Overrides
GetComponentCssClass()
Gets the component CSS class.
Declaration
protected override string GetComponentCssClass()Returns
| Type | Description | 
|---|---|
| string | 
Overrides
OnClick(MouseEventArgs)
Handles the button click event. This method is called internally when the button is clicked. It prevents multiple simultaneous clicks and invokes the Click callback.
Declaration
public virtual Task OnClick(MouseEventArgs args)Parameters
| Type | Name | Description | 
|---|---|---|
| MouseEventArgs | args | The mouse event arguments containing click information. | 
Returns
| Type | Description | 
|---|---|
| Task | A task representing the asynchronous operation. |