StartFoundationsComponentsContent

Button

A button runs one action or submits a form. It always has a text label.

Stable Figma
OverviewUsageAPIAccessibility
Save changes Place order
<tk-button>Save changes</tk-button>
<tk-button variant="primary" type="submit">Place order</tk-button>

Anatomy

Part What it is
tk-button the element; one Tab stop
default slot the text label, required; it is the accessible name
icon-start slot an optional leading icon
icon-end slot an optional trailing icon
button part the native <button> inside

Variants

Publish Save draft Preview Discard
<tk-button variant="primary">Publish</tk-button>
<tk-button>Save draft</tk-button>
<tk-button variant="outline">Preview</tk-button>
<tk-button variant="ghost">Discard</tk-button>
  • primary: the main action of a view. Use one per view.
  • secondary (default): most buttons, including Cancel and Back.
  • outline: when the button needs a visible edge, such as on a busy surface or in a joined Button group. Its border is light, so don't place it on a sunken surface such as a neutral Banner or Section message; use secondary or ghost there.
  • ghost: quiet or repeated actions, such as a row action in a table.

Danger

tone="danger" marks an action that deletes or removes something. It has one look, a red-tinted button with a red label, whatever variant you set.

Cancel Delete account
<tk-button>Cancel</tk-button>
<tk-button tone="danger">Delete account</tk-button>

Name what the action destroys in the label. Color alone doesn't tell everyone.

Shape

shape="round" makes a pill. It works with every variant and size. A joined button group or a Split button sets the corners itself.

Follow Subscribe
<tk-button shape="round">Follow</tk-button>
<tk-button variant="primary" shape="round">Subscribe</tk-button>

Sizes

Small Medium Large
<tk-button size="small">Small</tk-button>
<tk-button>Medium</tk-button>
<tk-button size="large">Large</tk-button>
size Height Padding-inline Label style Icon
small 24px space-8 Label Small (12/16) icon-size-16
medium (default) 32px space-12 Label Medium (14/20) icon-size-16
large 36px space-16 Label Medium (14/20) icon-size-16

A long label wraps and the button grows. small is exactly the 24px minimum target size, so don't scale or squeeze it.

States

Save changes Place order Pin to top
<tk-button disabled>Save changes</tk-button>
<tk-button variant="primary" loading>Place order</tk-button>
<tk-button pressed>Pin to top</tk-button>

Hover, press, and focus need no props. Keyboard focus shows a ring on every button.

  • disabled: the button can't be focused or clicked, and a danger button turns gray. Prefer keeping the button active and saying what to fix when it's clicked.
  • loading: a spinner replaces the label, the size stays the same, and repeat clicks are ignored. The button stays focusable and tells screen readers it's busy. If you also set disabled, the button is disabled.
  • pressed: the on state of a toggle. Wrap the button in Toggle button rather than setting it yourself. primary has no pressed look.

Full width

full-width makes the button fill its container. Use it for stacked actions on narrow screens, not in desktop forms.

Place order Back
<tk-button variant="primary" full-width>Place order</tk-button>
<tk-button full-width>Back</tk-button>

Icons

Add member Export
<tk-button><tk-icon slot="icon-start" name="plus"></tk-icon>Add member</tk-button>
<tk-button>Export<tk-icon slot="icon-end" name="chevron-down"></tk-icon></tk-button>
  • Put a tk-icon in icon-start to show what the action does, or in icon-end to show what happens next, such as a menu opening. Use one icon per button.
  • The button sizes the icon to 16px, colors it like the label, and hides it from screen readers.