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.
IComponent
IHandleEvent
IHandleAfterRender
RadzenComponent.SetParametersAsync
RadzenComponent.OnAfterRenderAsync
RadzenComponent.RaiseContextMenu
RadzenComponent.RaiseMouseEnter
RadzenComponent.AddContextMenu
RadzenComponent.RaiseMouseLeave
RadzenComponent.OnBecameInvisible
RadzenComponent.DefaultCulture
RadzenComponent.IsJSRuntimeAvailable
ComponentBase.OnInitializedAsync
ComponentBase.OnParametersSet
ComponentBase.OnParametersSetAsync
ComponentBase.StateHasChanged
ComponentBase.ShouldRender
ComponentBase.OnAfterRender
ComponentBase.InvokeAsync
ComponentBase.DispatchExceptionAsync
ComponentBase.RendererInfo
ComponentBase.Assets
ComponentBase.AssignedRenderMode
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
public class RadzenButton : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRenderBasic 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 />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.
public RadzenButton()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.
public string BusyText { get; set; }
| Type | Description |
|---|---|
| string | 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. |
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).
public ButtonStyle ButtonStyle { get; set; }
| Type | Description |
|---|---|
| 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). |
Gets or sets the HTML button type attribute. Use Submit for form submissions or Button for regular clickable buttons.
public ButtonType ButtonType { get; set; }
| Type | Description |
|---|---|
| ButtonType | Gets or sets the HTML button type attribute. Use Submit for form submissions or Button for regular clickable buttons. |
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.
public RenderFragment ChildContent { get; set; }
| Type | Description |
|---|---|
| RenderFragment | 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. |
Gets or sets the callback invoked when the button is clicked. This event will not fire if the button is Disabled or IsBusy.
public EventCallback<MouseEventArgs> Click { get; set; }
| 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. |
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.
public bool Disabled { get; set; }
| Type | Description |
|---|---|
| bool | 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. |
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.
public string Icon { get; set; }
| Type | Description |
|---|---|
| string | 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. |
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)").
public string IconColor { get; set; }
| Type | Description |
|---|---|
| string | 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)"). |
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.
public string Image { get; set; }
| Type | Description |
|---|---|
| string | 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. |
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.
public string ImageAlternateText { get; set; }
| Type | Description |
|---|---|
| string | 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. |
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.
public bool IsBusy { get; set; }
| Type | Description |
|---|---|
| bool | 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. |
Gets a value indicating whether this button is effectively disabled. The button is disabled if either Disabled is true or IsBusy is true.
public bool IsDisabled { get; }
| Type | Description |
|---|---|
| bool | Gets a value indicating whether this button is effectively disabled. The button is disabled if either Disabled is true or IsBusy is true. |
Gets or sets the color intensity shade for the button. Works in combination with ButtonStyle to adjust the color darkness/lightness.
public Shade Shade { get; set; }
| Type | Description |
|---|---|
| Shade | Gets or sets the color intensity shade for the button. Works in combination with ButtonStyle to adjust the color darkness/lightness. |
Gets or sets the button size. Controls the padding, font size, and overall dimensions of the button.
public ButtonSize Size { get; set; }
| Type | Description |
|---|---|
| ButtonSize | Gets or sets the button size. Controls the padding, font size, and overall dimensions of the button. |
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.
public int TabIndex { get; set; }
| Type | Description |
|---|---|
| int | 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. |
Gets or sets the text label displayed on the button. If both Text and Icon are set, both will be displayed.
public string Text { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the text label displayed on the button. If both Text and Icon are set, both will be displayed. |
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).
public Variant Variant { get; set; }
| Type | Description |
|---|---|
| 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). |
protected override void BuildRenderTree(Rendering.RenderTreeBuilder __builder)
| Type | Name | Description |
|---|---|---|
| Rendering.RenderTreeBuilder | __builder |
protected override string GetComponentCssClass()
| Type | Description |
|---|---|
| string |
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.
public virtual Task OnClick(MouseEventArgs args)
| Type | Name | Description |
|---|---|---|
| MouseEventArgs | args | The mouse event arguments containing click information. |
| Type | Description |
|---|---|
| Task | A task representing the asynchronous operation. |