Client component

Toolbar

A role="toolbar" container for grouped controls, on the APG toolbar pattern: arrow keys move focus between the focusable children, Home/End jump to the edges. Compose it with Button, SegmentedControl, CopyButton, or anything focusable.

Import#

import { Toolbar } from "astralis-ui";

Accessibility#

  • Give every toolbar a label: a toolbar without a name is just a row of buttons.
  • Icon-only controls need their own aria-label (or a VisuallyHidden text).

Props#

Extends div props:

PropTypeDefaultDescription
labelstringNoneAccessible name, set as aria-label. A toolbar without one is just a row of buttons.
orientation"horizontal" | "vertical""horizontal"Layout direction, and which arrow keys move focus.

Parts#

PropTypeDefaultDescription
Toolbar.Groupdiv propsNoneA cluster of related controls with the group role. Give it an aria-label.
Toolbar.Separatordiv propsNoneA vertical rule between groups.

Keyboard#

With focus on a control in the toolbar:

KeyAction
← / →Previous / next control (horizontal; wraps at the ends)
↑ / ↓Previous / next control (vertical; wraps at the ends)
Home / EndFirst / last control
TabNext control, or out of the toolbar after the last one

Disabled controls are skipped. Every control keeps its own tab stop, so Tab also walks through them one by one.