Toolbar
A row of related controls that is one stop in the tab order.
Live example
Text formatting
<dui-toolbar role="toolbar" aria-label="Text formatting">
<button type="button" aria-pressed="true">Bold</button>
<button type="button" aria-pressed="false">Italic</button>
<button type="button" aria-pressed="false">Underline</button>
<hr>
<button type="button">Insert link</button>
<button type="button">Clear formatting</button>
</dui-toolbar>
Vertical
<dui-toolbar role="toolbar" aria-label="Drawing tools" aria-orientation="vertical">
<button type="button" aria-pressed="true">Select</button>
<button type="button" aria-pressed="false">Pen</button>
<button type="button" aria-pressed="false">Eraser</button>
</dui-toolbar>
Attributes
| Attribute or value | Where | Effect |
|---|---|---|
role="toolbar" aria-label="…" | the container (<dui-toolbar> or any element) | |
aria-orientation="vertical" | optional; default horizontal | |
aria-pressed="true | false" | toggle buttons (native ARIA) | |
<hr> | a separator between groups of controls |
Keyboard
| Key | Action |
|---|---|
| Tab | moves into the toolbar (to the last focused control), then out of it |
| Right Arrow / Left Arrow | next or previous control, wrapping (swapped in right-to-left) |
| Down Arrow / Up Arrow | the same in a vertical toolbar |
| Home / End | first or last control |
| Enter / Space | activates the focused button |
Accessibility
- Use a toolbar for three or more controls. Without JavaScript, each control is a Tab stop.
- Toggle buttons use
aria-pressed, shown by more than color (WCAG 1.4.1).
Specifications
See also
- Molecules
- Source:
css/components/molecules/toolbar.css,examples/molecules/toolbar.html - Demos: Orders view (Plain HTML, React, Angular, Astro, Vue, Svelte)
How other systems do it
For comparison only; these are not the standard this system follows.
- Apple Human Interface Guidelines: Toolbars
- Material Design 3: Toolbars
- Vercel Geist: No equivalent