Components, Actions
Button
The button for every action that has a text label.
default
variant
size
state
Every button with a text label is built with this component. The fill is ink, and one group (a form, a dialog, a card, a page header) has only one fill button.
When to use
| variant | Use |
|---|---|
fill (default) |
The one primary action of the group. primary fill with primary-foreground text |
outline |
Secondary actions (cancel, export). 1px border, and the hover surface is accent |
ghost |
An action with no surface. tone="muted" is quieter, and tone="danger" is the weak form of a dangerous action |
link |
A text button inside a sentence. It follows the size of the surrounding text and has an underline |
danger |
The confirming button of an action that cannot be undone (delete). destructive fill |
danger-outline |
The dangerous button in a confirmation dialog |
fillis an ink fill with white text in light, and a paper fill with ink text in dark.- One group (a form, a dialog, a card, a page header) has one fill button. From the second button on, use
outline. - The hover of
fillis one step lighter ink in light, and one step darker paper in dark. linkisforegroundtext with an underline that is always visible, because color does not set it apart.- The tone of
ghostisdefault,mutedordanger. - The start button on public pages is
filllgwith a trailing arrow icon. There is no separate variant for it.
Sizes
There are four sizes: xs 28, sm 32, md 40 and lg 48.
Controls in one row share the same height. Toolbars use sm, forms and modals use md, and calls to action on public surfaces use lg.
What you provide
- The label. Start with a verb and write exactly what happens when the button is pressed (“Save”, “Reconnect”).
leadingIcon,trailingIcon: choose from the icon set. The button decides the size.loading: puts a spinner in the leading icon slot and keeps the label.classNameis for layout only.
Markup
<button type="button" class="BaseButton_btn BaseButton_btn--fill BaseButton_btn--md">Save</button>
<button type="button" class="BaseButton_btn BaseButton_btn--outline BaseButton_btn--md">Not now</button>
<button type="button" class="BaseButton_btn BaseButton_btn--link">Learn more</button>
Don’t
- Don’t put two fill buttons in one group. From the second button on, use
outline. - Don’t show a selected state with a fill button. Selection is an
accentsurface (BaseTab, CapsuleFilter). - Don’t use
pointer-events: nonefor the disabled state. - Don’t remove the focus ring.