Forms
TwButton
TwButton is a Blazor button component. Use Variant, Color, StartIcon, EndIcon, Href, Disabled and IconButton, or group buttons horizontally or vertically.
Last updated
Tooltips
Set
Tooltip to show a short description when the button is hovered or
keyboard-focused. It renders a role="tooltip" element linked to the button with
aria-describedby, stays visible while the pointer moves onto it, and can be
dismissed with Escape. A tooltip only supplements the accessible name, so icon-only
buttons still need an AriaLabel. The same Tooltip property works on an
icon button (TwIcon with OnClick).
RAZOR
<TwButtonGroup>
<TwButton Label="Save" Color="Color.Primary" StartIcon="Icon.Save" Tooltip="Save your changes" />
<TwButton Label="Delete" Variant="ButtonVariant.Outlined" Color="Color.Danger" Tooltip="This cannot be undone" />
<TwIcon Icon="Icon.Question_Circle" AriaLabel="Help" Tooltip="Open the help centre" OnClick="@(() => { /* your action */ })" />
</TwButtonGroup>All colors
Buttons support all color themes from the color palette:
RAZOR
<div class="flex flex-wrap gap-2">
@foreach (Color c in Enum.GetValues<Color>())
{
<TwButton Label="@c.ToString()" Color="@c" />
}
</div>Theme configuration
Styling is controlled by
TwBlazorTheme.Components (a TwButtonTheme), configured via the
AddTwBlazor() options callback described on the Get Started page.
Every property is a set of Tailwind classes, so changes are picked up by your own Tailwind build.
Inherited from TwButton - this component reuses that theme rather than defining its own.
| Property | Type | Controls |
|---|---|---|
ButtonRounded |
Rounded? | |
ButtonShadow |
Shadow? | |
DefaultVariant |
ButtonVariant? | |
ButtonUppercase |
bool | |
Uppercase |
string | |
Base |
string | |
Padding |
string | |
DensePadding |
string | |
IconButton |
string | |
Typography |
string | |
IconTypography |
string | |
DisabledCursor |
string | |
ReadonlyCursor |
string | |
DefaultCursor |
string | |
DisabledFilled |
string | |
DisabledOutlined |
string | |
DisabledText |
string |
Full reference: TwButtonTheme on the API docs.