Components, Actions
Icon button
A button that holds only an icon and always carries an accessible name.
variant
size
state
A button that holds only an icon. An accessible name (aria-label) is required.
When to use
| variant | Use |
|---|---|
ghost (default) |
Secondary controls in rows, headers and toolbars. tone is muted (default), default, danger or success (a temporary state such as a finished copy) |
outline |
A standalone control that needs a border (filter) |
fill |
Composer send. Use it with shape="circle" |
neutral |
Composer stop. A muted-foreground fill with a background icon, with shape="circle" |
fill, the send circle, is an ink fill in light and a paper fill in dark.
| size | Box | Icon | Pairs with |
|---|---|---|---|
xs |
24 | 14 | Clear inside an input, more inside a row |
sm (default) |
28 | 16 | Sits in a row with BaseButton xs |
md |
32 | 16 | Sits in a row with BaseButton sm. Modal close, attach, send, stop |
lg |
36 | 20 | Top bar only |
A toggle that has an on state (open panel) takes pressed. It sets aria-pressed="true" and the accent surface stays on.
What you provide
icon: one icon from the icon set. The button sets its size.aria-label: what happens when you press it (“Close”, “Copy”).tooltip: whentrue, the aria-label is shown as a tooltip. Turn it on when the icon alone does not carry the meaning.
Markup
<button type="button" class="IconButton_btn IconButton_btn--ghost-muted IconButton_btn--sm" aria-label="More">
<svg>…</svg>
</button>
Variant classes are IconButton_btn--ghost-muted|ghost-default|ghost-danger|ghost-success|outline|fill|neutral. Size classes are IconButton_btn--xs|sm|md|lg. The circle is IconButton_btn--circle, for fill and neutral only.
Don’t
- Don’t use the circle outside send and stop.
- Don’t put text in it. When there is text, use BaseButton.
- Don’t use purple icons. The
ghosttones aremuted,default,dangerandsuccessonly.