Skip to content
Vertical Jump Designs-uiFront-End Studio
Get Pro

v3.9 is out.

Navigation

Toolbar

Free2.6 KB gzipped

A row (or column) of controls that is one Tab stop, with arrow keys between controls.

Accessibility: WCAG 2.2 AA · No A or AA violations in light or dark mode · Keys: Tab, Shift+Tab, Arrow Right and 5 more · Full report

Import

tsx
import { Toolbar } from "@vjdesigns/vjdesigns-ui";

Importing only Toolbar adds about 2.6 KB of minified, gzipped JavaScript to your app (React not included). The stylesheet is shared by every component and loaded once: 75.1 KB gzipped.

Examples

Basic

The whole toolbar is one Tab stop. Arrow keys move between its controls, and Home and End jump to the first and last. A ToggleGroup inside joins the toolbar's arrow keys.

tsx
import {
  IconButton,
  LinkIcon,
  ToggleGroup,
  Toolbar,
} from "@vjdesigns/vjdesigns-ui";

export function Basic() {
  return (
    <Toolbar aria-label="Text formatting">
      <ToggleGroup type="multiple" aria-label="Text style" variant="ghost" tone="neutral" size="sm">
        <ToggleGroup.Item value="bold">Bold</ToggleGroup.Item>
        <ToggleGroup.Item value="italic">Italic</ToggleGroup.Item>
        <ToggleGroup.Item value="underline">Underline</ToggleGroup.Item>
      </ToggleGroup>
      <Toolbar.Separator />
      <ToggleGroup type="single" aria-label="Alignment" variant="ghost" tone="neutral" size="sm" defaultValue="start" required>
        <ToggleGroup.Item value="start">Left</ToggleGroup.Item>
        <ToggleGroup.Item value="center">Center</ToggleGroup.Item>
        <ToggleGroup.Item value="end">Right</ToggleGroup.Item>
      </ToggleGroup>
      <Toolbar.Separator />
      <IconButton aria-label="Insert link" variant="ghost" tone="neutral" size="sm">
        <LinkIcon />
      </IconButton>
    </Toolbar>
  );
}

Variants

variant="plain" drops the border and background. orientation="vertical" stacks the controls and uses the Up and Down arrows.

tsx
import {
  CopyIcon,
  EditIcon,
  IconButton,
  Toolbar,
  TrashIcon,
} from "@vjdesigns/vjdesigns-ui";

export function Variants() {
  return (
    <div style={{ display: "flex", gap: "1.5rem", alignItems: "flex-start", flexWrap: "wrap" }}>
      <Toolbar variant="plain" aria-label="Row actions">
        <IconButton aria-label="Edit" variant="ghost" tone="neutral" size="sm">
          <EditIcon />
        </IconButton>
        <IconButton aria-label="Copy" variant="ghost" tone="neutral" size="sm">
          <CopyIcon />
        </IconButton>
        <IconButton aria-label="Delete" variant="ghost" tone="danger" size="sm">
          <TrashIcon />
        </IconButton>
      </Toolbar>
      <Toolbar orientation="vertical" aria-label="Drawing tools">
        <IconButton aria-label="Edit" variant="ghost" tone="neutral" size="sm">
          <EditIcon />
        </IconButton>
        <IconButton aria-label="Copy" variant="ghost" tone="neutral" size="sm">
          <CopyIcon />
        </IconButton>
        <Toolbar.Separator />
        <IconButton aria-label="Delete" variant="ghost" tone="danger" size="sm">
          <TrashIcon />
        </IconButton>
      </Toolbar>
    </div>
  );
}

With input

A text field keeps its own caret keys: the arrow keys, Home and End edit the text. Tab still leaves the toolbar. wrap moves controls onto a new line when there isn't room, keeping each Toolbar.Group together.

tsx
import {
  FilterIcon,
  IconButton,
  Input,
  MoreHorizontalIcon,
  SearchIcon,
  Toolbar,
} from "@vjdesigns/vjdesigns-ui";

export function WithInput() {
  return (
    <div style={{ width: "100%", maxWidth: "34rem" }}>
      <Toolbar wrap aria-label="Roster tools">
        <Toolbar.Group aria-label="Search">
          <Input aria-label="Search players" placeholder="Search players" size="sm" startIcon={<SearchIcon />} />
        </Toolbar.Group>
        <Toolbar.Group aria-label="Actions">
          <IconButton aria-label="Filter" variant="ghost" tone="neutral" size="sm">
            <FilterIcon />
          </IconButton>
          <IconButton aria-label="More actions" variant="ghost" tone="neutral" size="sm">
            <MoreHorizontalIcon />
          </IconButton>
        </Toolbar.Group>
      </Toolbar>
    </div>
  );
}

Disabled and no loop

Disabled controls are skipped. With loop={false}, the arrow keys stop at the first and last control instead of wrapping.

tsx
import {
  CopyIcon,
  EditIcon,
  IconButton,
  Toolbar,
  TrashIcon,
} from "@vjdesigns/vjdesigns-ui";

export function DisabledAndNoLoop() {
  return (
    <Toolbar loop={false} aria-label="Message actions">
      <IconButton aria-label="Edit" variant="ghost" tone="neutral" size="sm">
        <EditIcon />
      </IconButton>
      <IconButton aria-label="Copy" variant="ghost" tone="neutral" size="sm" disabled>
        <CopyIcon />
      </IconButton>
      <IconButton aria-label="Delete" variant="ghost" tone="danger" size="sm">
        <TrashIcon />
      </IconButton>
    </Toolbar>
  );
}

Right to left

In right-to-left layouts the toolbar mirrors, and Arrow Left moves to the next control.

tsx
import {
  IconButton,
  LinkIcon,
  LocaleProvider,
  ToggleGroup,
  Toolbar,
} from "@vjdesigns/vjdesigns-ui";
import ar from "@vjdesigns/vjdesigns-ui/locales/ar";

export function RightToLeft() {
  return (
    <LocaleProvider locale="ar" messages={ar}>
      <div dir="rtl">
        <Toolbar aria-label="أدوات التنسيق">
          <ToggleGroup type="multiple" aria-label="نمط النص" variant="ghost" tone="neutral" size="sm">
            <ToggleGroup.Item value="bold">غامق</ToggleGroup.Item>
            <ToggleGroup.Item value="italic">مائل</ToggleGroup.Item>
          </ToggleGroup>
          <Toolbar.Separator />
          <IconButton aria-label="إدراج رابط" variant="ghost" tone="neutral" size="sm">
            <LinkIcon />
          </IconButton>
        </Toolbar>
      </div>
    </LocaleProvider>
  );
}

API reference

Toolbar

New in 3.5.1
Toolbar props
PropTypeDefault
orientation

Direction of the controls. Also picks the arrow keys: Left/Right when horizontal (following the reading direction), Up/Down when vertical.

"horizontal""vertical""horizontal"
variant

surface: a rounded, bordered bar. plain: no container styling.

"plain""surface""surface"
loop

Arrow keys wrap from the last control to the first, and back.

booleantrue
wrap

Let controls wrap onto more lines when there isn't room (horizontal only).

booleanfalse
children

The controls: buttons, toggle groups, links, menus, inputs, Toolbar.Separator, and Toolbar.Group.

ReactNode—

Also accepts native <div> attributes, plus className, style and ref.

Toolbar.Separator

New in 3.5.1

A line between groups of controls, drawn across the toolbar's direction (role="separator"). It isn't focusable, and arrow keys skip it.

Toolbar.Separator props
PropTypeDefault
className

Additional class for the separator.

string—

Toolbar.Group

New in 3.5.1

Keeps related controls together (role="group"), so a wrapping toolbar moves them to the next line as one. Its controls stay in the toolbar's arrow-key order.

Toolbar.Group props
PropTypeDefault
children

Related controls. Name the group with aria-label (e.g. "Alignment") if the controls don't make it obvious.

ReactNode—

Also accepts native <div> attributes, plus className, style and ref.

See what changed in each version in the Changelog.

Accessibility report

Toolbar targets WCAG 2.2 AA. Below: a live axe-core audit of this page's examples, Lighthouse scores for the page in both modes, the accessibility behavior built into the component, and the checks only a person can do.

axe-core audit (live)

Running accessibility audit

Checking the examples above…

Lighthouse audit

Light mode

Score 100

36 passed · 0 failed · 29 not applicable · 10 to check by hand

Dark mode

Score 100

36 passed · 0 failed · 29 not applicable · 10 to check by hand

Lighthouse 13.5.0 audits the whole docs page (header and sidebar included), not just the examples, in English. Last run 11/27/2026. Some failed audits carry no weight in the score, so a page can score 100 and still list one.

Built-in behavior

Keyboard

Keyboard
KeyAction
TabShift+TabMoves into the toolbar, on the control used last (or the first), and out of it. The toolbar is one Tab stop.
Arrow RightArrow LeftHorizontal: next or previous control, wrapping unless loop={false} (mirrored right to left). Disabled controls are skipped.
Arrow DownArrow UpVertical: next or previous control.
HomeEndFirst or last control.

In a text field, the arrow keys, Home and End keep editing the text. A ToggleGroup joins the toolbar's arrow keys; widgets with their own arrow keys (radio groups, tabs, SegmentedControl) stay a separate Tab stop.

Roles and states

Roles and states
ElementRoleStates and properties
Toolbartoolbararia-orientation, aria-label or aria-labelledby (warns in development without one)
Toolbar.Groupgrouparia-label (optional)
Toolbar.Separatorseparatoraria-orientation across the toolbar; not focusable

Manual checks

Automated tools find roughly a third of accessibility issues. Test these in your app, with your content.

Manual accessibility checks
CheckWhat to testWCAG 2.2
KeyboardEvery action works with Tab, Shift+Tab, Enter, Space and the arrow keys, and focus never gets stuck.2.1.1 (A), 2.1.2 (A)
FocusFocus moves in a logical order, is always visible, and isn't hidden behind sticky headers.2.4.3 (A), 2.4.7 (AA), 2.4.11 (AA), 2.4.13 (AAA)
Screen readersNames, roles and states are announced correctly, and status changes are announced without moving focus.1.3.1 (A), 4.1.2 (A), 4.1.3 (AA)
ColorMeaning never depends on color alone; your own colors meet contrast in both modes.1.4.1 (A), 1.4.3 (AA), 1.4.11 (AA), 1.4.6 (AAA)
Zoom and reflowAt 200% text size and at 320px wide (400% zoom), nothing is cut off and no sideways scrolling is needed.1.4.4 (AA), 1.4.10 (AA), 1.4.12 (AA)
Pointer targetsClick and tap targets are at least 24×24px (44×44px for AAA), or spaced so they don't overlap.2.5.8 (AA), 2.5.5 (AAA)
MotionAnimations respect the reduced-motion setting.2.3.3 (AAA)