RadzenButton Class

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

Implements

IComponent

IHandleEvent

IHandleAfterRender

Namespace: Radzen.Blazor

Assembly: Radzen.Blazor.dll

Syntax

public class RadzenButton : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRender

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 />

Constructors

RadzenButtonlink

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()

Properties

BusyTextlink

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
public string BusyText { get; set; }
Property Value
Type Description
stringGets 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.

ButtonStylelink

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
public ButtonStyle ButtonStyle { get; set; }
Property Value
Type Description
ButtonStyleGets 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).

ButtonTypelink

Gets or sets the HTML button type attribute. Use Submit for form submissions or Button for regular clickable buttons.

Declaration
public ButtonType ButtonType { get; set; }
Property Value
Type Description
ButtonTypeGets or sets the HTML button type attribute. Use Submit for form submissions or Button for regular clickable buttons.

ChildContentlink

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
public RenderFragment ChildContent { get; set; }
Property Value
Type Description
RenderFragmentGets 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.

Clicklink

Gets or sets the callback invoked when the button is clicked. This event will not fire if the button is Disabled or IsBusy.

Declaration
public EventCallback<MouseEventArgs> Click { get; set; }
Property Value
Type Description
EventCallback<MouseEventArgs>Gets or sets the callback invoked when the button is clicked. This event will not fire if the button is Disabled or IsBusy.

Disabledlink

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
public bool Disabled { get; set; }
Property Value
Type Description
boolGets 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.

Iconlink

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
public string Icon { get; set; }
Property Value
Type Description
stringGets 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.

IconColorlink

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
public string IconColor { get; set; }
Property Value
Type Description
stringGets 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)").

Imagelink

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
public string Image { get; set; }
Property Value
Type Description
stringGets 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.

ImageAlternateTextlink

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
public string ImageAlternateText { get; set; }
Property Value
Type Description
stringGets or sets the alternate text for the button's image. This is used as the alt attribute when an Image is specified, improving accessibility.

IsBusylink

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
public bool IsBusy { get; set; }
Property Value
Type Description
boolGets 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.

IsDisabledlink

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
boolGets a value indicating whether this button is effectively disabled. The button is disabled if either Disabled is true or IsBusy is true.

Shadelink

Gets or sets the color intensity shade for the button. Works in combination with ButtonStyle to adjust the color darkness/lightness.

Declaration
public Shade Shade { get; set; }
Property Value
Type Description
ShadeGets or sets the color intensity shade for the button. Works in combination with ButtonStyle to adjust the color darkness/lightness.

Sizelink

Gets or sets the button size. Controls the padding, font size, and overall dimensions of the button.

Declaration
public ButtonSize Size { get; set; }
Property Value
Type Description
ButtonSizeGets or sets the button size. Controls the padding, font size, and overall dimensions of the button.

TabIndexlink

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
public int TabIndex { get; set; }
Property Value
Type Description
intGets or sets the tab index for keyboard navigation. Controls the order in which the button receives focus when the user presses the Tab key.

Textlink

Gets or sets the text label displayed on the button. If both Text and Icon are set, both will be displayed.

Declaration
public string Text { get; set; }
Property Value
Type Description
stringGets or sets the text label displayed on the button. If both Text and Icon are set, both will be displayed.

Variantlink

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
public Variant Variant { get; set; }
Property Value
Type Description
VariantGets 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).

Methods

BuildRenderTreelink

Declaration
protected override void BuildRenderTree(Rendering.RenderTreeBuilder __builder)
Parameters
Type Name Description
Rendering.RenderTreeBuilder __builder

GetComponentCssClasslink

Declaration
protected override string GetComponentCssClass()
Returns
Type Description
string

OnClicklink

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
TaskA task representing the asynchronous operation.
An error has occurred. This app may no longer respond until reloaded. Reload 🗙