@code { /// /// The content to be displayed inside the button. /// [Parameter] public RenderFragment? ChildContent { get; set; } /// /// The event to call when the button is clicked. /// [Parameter] public EventCallback OnClick { get; set; } /// /// Specifies whether the button is disabled. /// [Parameter] public bool IsDisabled { get; set; } /// /// Specifies the type of the button. Default is "button". /// [Parameter] public string Type { get; set; } = "button"; /// /// The color theme of the button. /// [Parameter] public string Color { get; set; } = "primary"; /// /// Additional CSS classes to apply to the button. /// [Parameter] public string AdditionalClasses { get; set; } = ""; /// /// The display class of the button. Defaults to inline. /// [Parameter] public string Display { get; set; } = "inline"; /// /// Handles the button click event. /// private async Task HandleClick() { if (!IsDisabled) { await OnClick.InvokeAsync(); } } /// /// Gets the CSS classes for the button based on its state and color. /// /// A string containing the CSS classes for the button. private string GetButtonClasses() { var colorClasses = ButtonStyles.GetColorClasses(Color); var disabledClasses = IsDisabled ? ButtonStyles.DisabledClasses : ""; return $"{Display} {ButtonStyles.BaseClasses} {colorClasses} {disabledClasses} {AdditionalClasses}".Trim(); } }