Skip to content

Toolbar

A grouping container (role="toolbar") for a set of related controls, with the toolbar keyboard pattern.

<script>
import Toolbar from "@invisible-ui/svelte/Toolbar.svelte";
</script>

In Elements:

<ds-toolbar label="Formatting">
<ds-button>Bold</ds-button>
<ds-button>Italic</ds-button>
<ds-separator orientation="vertical" decorative></ds-separator>
<ds-button aria-label="Add" icon-only>+</ds-button>
</ds-toolbar>

Controls added, removed or disabled later keep a single tab stop.

PropTypeDefaultDescription
label *string—
orientation"horizontal" | "vertical""horizontal"
flatbooleanfalseBorderless presentation: the controls inside lose their individual border/fill at rest (they read as one group, divided only by separators) with a subtle hover overlay.
  • role="toolbar" with aria-orientation; a label is required.
  • Single tab stop (roving tabindex); arrow keys move between controls (Left/Right horizontal, Up/Down vertical), plus Home/End with wrapping.
  • A control that needs a key keeps it: in a text input, Left/Right (Up/Down in a vertical toolbar) move the caret and Home/End go to the ends of the text, and a multi-line field keeps every arrow. Tab leaves the toolbar from a text input.
<Toolbar label="Formatting">
<ToggleButton label="Bold">B</ToggleButton>
<ToggleButton label="Italic">I</ToggleButton>
<Separator orientation="vertical" decorative />
<Button ariaLabel="Add">+</Button>
</Toolbar>

In React, the controls are the children. The toolbar finds them in the page, so any component that renders a button takes part:

<Toolbar label="Formatting">
<ToggleButton label="Bold">B</ToggleButton>
<ToggleButton label="Italic">I</ToggleButton>
<Separator orientation="vertical" decorative />
<Button ariaLabel="Add" iconOnly>
+
</Button>
</Toolbar>

Themeable via --ds-toolbar-gap.