StartFoundationsComponentsContent

Icon button

An icon button runs one action and shows a single icon instead of a text label. Its label names it for screen readers.

Stable Figma
OverviewUsageAPIAccessibility
<tk-icon-button label="Search"><tk-icon name="search"></tk-icon></tk-icon-button>
<tk-icon-button label="Settings"><tk-icon name="settings"></tk-icon></tk-icon-button>
<tk-icon-button label="More actions"><tk-icon name="more-horizontal"></tk-icon></tk-icon-button>

Anatomy

Part What it is
tk-icon-button the element; one Tab stop; a fixed square
default slot one icon, required; hidden from screen readers
pressed slot an optional icon shown while pressed, such as a filled twin
button part the native <button> inside; label becomes its accessible name

Variants

<tk-icon-button label="Edit"><tk-icon name="edit"></tk-icon></tk-icon-button>
<tk-icon-button variant="secondary" label="Edit"><tk-icon name="edit"></tk-icon></tk-icon-button>
<tk-icon-button variant="outline" label="Edit"><tk-icon name="edit"></tk-icon></tk-icon-button>
<tk-icon-button variant="primary" label="Edit"><tk-icon name="edit"></tk-icon></tk-icon-button>
  • ghost (default): a bare icon with no container. Use it in toolbars, headers, and rows. Unlike a ghost Button, its icon and hover tint are neutral, not accent.
  • secondary: a filled square, for an icon action that needs the weight of a visible control.
  • outline: a bordered square, for a visible edge 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 ghost or secondary there.
  • primary: the main quick action of a bar. Use at most one filled icon button per bar.

Danger

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

<tk-icon-button tone="danger" label="Delete file"><tk-icon name="trash"></tk-icon></tk-icon-button>

An icon gives no words at the moment of the click, so a danger icon button must open a confirmation, such as a confirm Dialog that names what will be deleted. Never delete on the first click.

Shape

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

<tk-icon-button shape="round" label="Add"><tk-icon name="plus"></tk-icon></tk-icon-button>
<tk-icon-button variant="secondary" shape="round" label="Share"><tk-icon name="share"></tk-icon></tk-icon-button>

Sizes

<tk-icon-button size="small" label="Close"><tk-icon name="close"></tk-icon></tk-icon-button>
<tk-icon-button label="Close"><tk-icon name="close"></tk-icon></tk-icon-button>
<tk-icon-button size="large" label="Close"><tk-icon name="close"></tk-icon></tk-icon-button>
size Square Icon Radius (rect)
small 24×24px icon-size-16 radius-8
medium (default) 32×32px icon-size-16 radius-8
large 36×36px icon-size-16 radius-8

The squares match Button's heights, so mixed rows line up. small is exactly the 24px minimum target size, so don't scale it, give it a negative margin, or let anything overlap it. The button sizes the icon to 16px at every size.

States

<tk-icon-button disabled label="Edit"><tk-icon name="edit"></tk-icon></tk-icon-button>
<tk-icon-button loading label="Download report"><tk-icon name="download"></tk-icon></tk-icon-button>

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

  • disabled: the button can't be focused or clicked, and a danger button turns gray. Prefer keeping the button active.
  • loading: a spinner replaces the icon, the square stays the same, and repeat clicks are ignored. The button stays focusable, keeps its label, and tells screen readers it's busy. If you also set disabled, the button is disabled.
  • pressed: the on state of a toggle; see below.

Toggle

For on and off actions, such as bookmark, favorite, mute, or pin, set pressed. Put the filled twin of the icon in the pressed slot and the button swaps them.

<tk-icon-button label="Bookmark" pressed>
  <tk-icon name="bookmark"></tk-icon>
  <tk-icon slot="pressed" name="bookmark-filled"></tk-icon>
</tk-icon-button>
  • pressed sets aria-pressed. A button without the prop is not announced as a toggle.
  • The label names the action, never the state: "Mute", not "Muted". Screen readers add "pressed" themselves, so a label that flips reads backwards.
  • You control pressed. The button never flips it and fires no change event. Listen for click and set it, or wrap the button in Toggle button, which does it for you.
  • Every variant except primary adds a tint while pressed. Without a pressed icon, the tint alone shows the state.
  • Don't combine pressed with tone="danger".

Tooltip

Wrap an icon button in a label Tooltip so sighted users see its name on hover and focus. Leave out the tooltip's text: it shows the button's label, so the two never disagree.

<tk-tooltip type="label">
  <tk-icon-button label="Copy link"><tk-icon name="link"></tk-icon></tk-icon-button>
</tk-tooltip>

Do it for any icon that isn't obvious. A bare icon button with a label is still accessible.