Skip to content

Button ​

Runs an action straight away.

base-basebutton--variantsOpen in Storybook ↗

When to use ​

  • Any action that happens when it is clicked: save, open, export, delete.
  • Pick the variant by the role of the action on the screen, not by how prominent you want it to look.

When not to use ​

Variants ​

VariantUse forColour
primarythe one action a screen leads with (Open record)client accent; follows the client theme
commitwriting a change (Save, confirm)platform teal; never themed
secondaryeverything alongside (Cancel) — the defaultwhite with a border
ghostdense toolbars and low-emphasis actions (Show more)no border, muted ink
dangerdestructive actions (Delete)red

Two sizes: md (default) and sm, for toolbars, panel headers and menus.

Keep one primary or commit button per group of actions.

Anatomy ​

  1. Container: a rectangle. secondary uses --radius-input; the others use --radius-button. Padding comes from --button-md-padding or --button-sm-padding.
  2. Icon (optional): before the label, --button-gap apart. An icon-only button uses --button-md-padding-icon or --button-sm-padding-icon.
  3. Label: bold, --text-button-md or --text-button-sm, on one line.
  4. Reason icon (optional): a help icon after the label on a disabled button; its tooltip says why the action is unavailable.

States ​

StateWhat you seeTrigger
Restingper variant—
Hoverdarker or washed fill; primary also gets an accent shadowpointer
Focus--focus-ring-width ring in --color-focus-ringkeyboard
Pressedthe button shrinks slightlypress
Loadingdisabled look; a spinner replaces the icon (or covers the label) and the width stays the sameasync action
Disableddisabled ink on a neutral fillaction unavailable
Disabled with a reasondisabled look plus a help icon with a tooltipaction unavailable, with an explanation
base-basebutton--statesOpen in Storybook ↗

In narrow containers a button with an icon hides its label visually and keeps it as the accessible name, so it becomes icon-only. Buttons that must always show their label opt out of this.

Keyboard & accessibility ​

  • It is a native <button type="button">: Tab reaches it, Enter and Space run it.
  • Icon-only buttons need a name: a label (hidden visually) or an aria-label such as Edit field.
  • A disabled button is skipped by Tab.
  • A disabled button with a reason stays reachable by Tab (aria-disabled="true"), so keyboard and screen-reader users can find out why. Clicks do nothing.
  • A loading button is disabled and has aria-busy="true".
base-basebutton--icon-onlyOpen in Storybook ↗

Content ​

  • Start with a verb, in sentence case: Save, Add person, Open record.
  • Say what happens, not what the control is: Export, not Export button.
  • Keep labels short; they never wrap.
  • A disabled reason says what to do: Select at least one item first.

Split button · Overflow menu · Colour · Accessibility

Powered by Elody - Open Source Semantic Data Platform