Component

BOBButton

The workhorse of any UI. Multiple variants, sizes, loading states, icons, and colors — all driven by parameters.

API reference ↗

Basic usage

RAZOR
<BOBButton Text="Click me" OnClick="@(() => { })" />

Sizes

RAZOR
<BOBButton Text="Small" Size="BOBSize.Small" />
<BOBButton Text="Medium" Size="BOBSize.Medium" />
<BOBButton Text="Large" Size="BOBSize.Large" />

Icons

Icons can be placed before or after the text.

RAZOR
<BOBButton Text="Add" LeadingIcon="@BOBIconKeys.MaterialIconsOutlined.i_add" />
<BOBButton Text="Next" TrailingIcon="@BOBIconKeys.MaterialIconsOutlined.i_arrow_forward" />
<BOBButton Text="Save" LeadingIcon="@BOBIconKeys.MaterialIconsOutlined.i_save"
           TrailingIcon="@BOBIconKeys.MaterialIconsOutlined.i_check" />

Colors

Use semantic PaletteColor values, or any CSS color string.

RAZOR
<BOBButton Text="Primary" BackgroundColor="@PaletteColor.Primary" Color="@PaletteColor.PrimaryContrast" />
<BOBButton Text="Success" BackgroundColor="@PaletteColor.Success" Color="@PaletteColor.SuccessContrast" />
<BOBButton Text="Warning" BackgroundColor="@PaletteColor.Warning" Color="@PaletteColor.WarningContrast" />
<BOBButton Text="Error" BackgroundColor="@PaletteColor.Error" Color="@PaletteColor.ErrorContrast" />

Loading state

While Loading is true, the button is disabled and shows an indicator.

RAZOR
<BOBButton Text="Submitting" Loading="true" />
<BOBButton Text="Ring" Loading="true" LoadingIndicatorVariant="BOBLoadingIndicatorVariant.Ring" />
<BOBButton Text="Dots" Loading="true" LoadingIndicatorVariant="BOBLoadingIndicatorVariant.Dots" />
<BOBButton Text="Bars" Loading="true" LoadingIndicatorVariant="BOBLoadingIndicatorVariant.Bars" />

Disabled

RAZOR
<BOBButton Text="Disabled" Disabled="true" />

Full width

RAZOR
<div style="width: 100%;">
    <BOBButton Text="Full-width button" FullWidth="true" />
</div>

Shadow & Border

RAZOR
<BOBButton Text="Elevated" Shadow="@BOBShadowPresets.Elevation(3)" />
<BOBButton Text="Pill" Border="@BOBBorderPresets.Pill" />
<BOBButton Text="Rounded" Border="@BOBBorderPresets.RoundedLarge" />
<BOBButton Text="Strong" Border="@BOBBorderPresets.Strong" />

Transitions

Built-in transition presets for hover/click feedback.

RAZOR
<BOBButton Text="Hover scale" Transitions="@BOBTransitionPresets.HoverScale" />
<BOBButton Text="Hover lift" Transitions="@BOBTransitionPresets.HoverLift" />
<BOBButton Text="Material" Transitions="@BOBTransitionPresets.MaterialButton" />

Properties

20 rows.
PropertyTypeDefaultDescription
ChildContentRenderFragment?Customizable Button content.
Textstring?Text displayed inside the button. Ignored when is provided.
LeadingIconIconKey?Closed-catalog icon key rendered before the button text.
TrailingIconIconKey?Closed-catalog icon key rendered after the button text.
OnClickEventCallback<MouseEventArgs>Raised when the button is clicked and not disabled.
AriaLabelstring?/// Accessible name for the button. Required when the button has no visible text /// (icon-only, -only without text). Forwarded to the /// inner &lt;button&gt; element. WCAG 4.1.2 Name, Role, Value. ///
TransitionsBOBTransitions?Transition classes applied to the button element.
SizeBOBSizeBOBSize.MediumVisual size of the button.
FullWidthboolWhen , the button spans the full width of its container.
LoadingboolWhen , the button shows a loading indicator and is non-interactive.
LoadingIndicatorVariantBOBLoadingIndicatorVariant?Variant of the loading indicator shown when is .
ShadowShadowStyle?Shadow style applied to the button.
BorderBorderStyle?Border style applied to the button.
DisableRippleboolWhen , the ripple effect on click is disabled.
RippleColorstring?Custom CSS color for the ripple effect.
RippleDurationMsint?Duration of the ripple animation in milliseconds.
DensityBOBDensityBOBDensity.StandardVertical density (gap) of the button.
BackgroundColorstring?Background color of the button. Accepts any valid CSS color value.
Colorstring?Text and icon color of the button. Accepts any valid CSS color value.
DisabledboolWhen , the button is non-interactive.