On this page

Button

Anatomy, colour tokens for every variant and state, sizes and spacing of Button.

Anatomy

A button has one container and up to four parts inside it. Only the label is required, except on an icon-only button.

  1. Container. Carries the fill, the border and the radius.
  2. Leading icon. Optional, 16 px, before the label.
  3. Label. A verb or a verb and a noun, in sentence case.
  4. Trailing icon. Only an external-link icon or a menu chevron.
  5. Spinner. Takes the leading icon’s place while the button is loading.

The focus ring sits outside the container: 2 px, 2 px away.

Colour by variant and state

Hover and pressed change the fill. Text keeps its rest colour; only the Default button’s border darkens one step. Disabled uses its own colours, never opacity.

Variant Rest Hover Pressed Text
Primary color.background.primary color.background.primary.hover color.background.primary.pressed color.text.inverse
Default color.surface, border color.border button.background.subtle.hover, border color.border.hover button.background.subtle.pressed, border color.border.hover color.text
Subtle none button.background.subtle.hover button.background.subtle.pressed color.text
Danger color.background.danger.bold color.background.danger.bold.hover color.background.danger.bold.pressed color.text.on-bold
Subtle danger none color.background.danger.subtle.hover color.background.danger.subtle.pressed color.text.danger
Link none, underlined none none color.link, color.link.hover on hover

The primary button rests on graphite 12, the last step, so it moves back one step on hover and two when pressed.

State Filled and Default Subtle, Subtle danger and Link
Unavailable (aria-disabled) and disabled Fill color.background.disabled, text color.text.disabled, border color.border.disabled No fill, no border; text color.text.disabled
Focus Ring color.border.focus, border.width.focused, offset state.focus.offset Same
Toggle on (aria-pressed="true") Default: fill button.background.selected, border button.border.selected Subtle: the same fill and border
Open menu (aria-expanded="true") Default keeps button.background.subtle.pressed while the menu is open Subtle does the same

Sizes

Match the height of the fields next to the button.

Size Height Padding Label Radius Icon
Small size.control.small (24 px) space.control.x.small (8 px) font.label.small radius.control.small (4 px) size.icon.default (16 px)
Default size.control.default (32 px) space.control.x (12 px) font.label.default radius.control (6 px) size.icon.default (16 px)
Large size.control.large (40 px) space.control.x.large (16 px) font.label.default radius.control (6 px) size.icon.default (16 px)

An icon-only button is a square of the same height. On touch screens every button responds to a tap in at least size.target.touch (44 px); the visible size stays the same.

Spacing

Between Token
Icon and label space.control.gap (4 px)
Buttons in a row space.100 (8 px)
Icon-only buttons in a row space.150 (12 px)

Motion

What Token
Colour change on hover and press motion.control
Wait before the spinner shows motion.wait.spinner (1000 ms)
One turn of the spinner motion.loop.spinner (1 s)

Component tokens

Button has four component tokens. The hover and pressed pair exist because a button is never selected, so it can take a stronger hover than a table row; the selected pair keeps a toggle that is on clearly apart from that hover.

TokenValueDescription
--bh-button-background-subtle-hover{color.background.neutral.transparent.hover}#00000018Dark: #ffffff12Subtle and Default buttons on hover: color.background.neutral.transparent.hover (about 4% black in light), laid over whatever is under the button. Rows and menu items keep color.background.neutral.subtle.hover.
--bh-button-background-subtle-pressed{color.background.neutral.transparent.pressed}#00000024Dark: #ffffff1aSubtle and Default buttons while pressed: color.background.neutral.transparent.pressed (about 8% black in light). Not in the contrast check; text and border keep their rest colour.
--bh-button-background-selected{color.graphite.5}#cdcccbDark: {color.graphite.6} → #454443A toggle button that is on (aria-pressed="true"): two neutral steps above the button hover (graphite 5 in light), so it never looks like a hovered button. Always with color.border.bold as the second cue.
--bh-button-border-selected{color.border.bold}#7b7976Dark: #878682Edge of a toggle button that is on. The second cue next to button.background.selected.