Toolbar

A bar of buttons, toggles and menus that the arrow keys move between.

Installation

  1. Add the registryOnce per project
  2. Add toolbar

Usage

Use a toolbar for controls that act on the same thing, such as the selection in an editor. Tab reaches it once, and the arrow keys move between its controls. Give it an aria-label.

Group toggles in a ToolbarToggleGroup, with multiple to allow more than one. ToolbarGroup groups other controls, and ToolbarSeparator divides groups.

For buttons that each take a Tab stop, use a Button Group.

Composition

Examples

With tooltips

Pass a ToolbarButton to a TooltipTrigger's render prop.

With a menu

Render a menu's trigger through a ToolbarButton's render prop to keep it in the arrow key order. ToolbarLink adds a link.

With an input

ToolbarInput adds a text field. Use at most one, and put it last, since the arrow keys also move its cursor.

Vertical

Set orientation="vertical" to stack the controls.

Props

The tables leave out className, style and render. Parts built on Base UI take them as its styling and composition guides describe.

Toolbar

ToolbarGroup

ToolbarButton

ToolbarToggleGroup

ToolbarToggle

ToolbarSeparator

ToolbarInput