Skip to content

Patterns · Actions

Toolbar

Search, controls and trailing actions above a list, with arrow-key focus movement.

@rookcom/monarch-reactPattern

List tools

Usage examples

The example at the top of the page is the only one for this component.

Purpose

A role="toolbar" row for the controls above a list or board: a search slot, grouped controls, trailing controls and an optional filters row underneath.

Use when

  • Several related controls act on the same list or view (search, filter, sort, export).

Avoid when

  • A form with labelled fields: use Field or SettingsSection.
  • One or two buttons: place them directly, no toolbar role needed.

Design principles

  • One Tab stop region with arrow keys inside, as the ARIA toolbar pattern expects.
  • Text inputs keep their own Left/Right keys so typing is never hijacked.
  • Trailing controls (end) align to the inline end.

API reference

import { Toolbar, ToolbarGroup } from '@rookcom/monarch-react';
ExportKindRenderingRoot class
Toolbarcomponentclient.mn-toolbar-wrap
ToolbarGroupcomponentclient.mn-toolbar-wrap

Native div attributes go to the inner role="toolbar" element; className goes to the outer .mn-toolbar-wrap.

Your onKeyDown runs first; calling preventDefault() skips the built-in arrow handling.

ToolbarGroup renders a role="group" div for visual grouping.

Generated from the TypeScript declarations of packages/react/src/patterns/actions/toolbar.

Properties

Toolbar

`role="toolbar"` with roving focus: Tab enters the toolbar, Left/Right move between controls, Home/End jump. Text inputs keep their own arrow keys.

PropTypeDescription
label requiredstringAccessible name, e.g. "Ticket list tools". Required by the toolbar role.
childrenReactNode
classNamestring
endReactNodeControls on the trailing edge (view switch, density, export).
filtersReactNodeFilter chips row rendered under the toolbar.
idstring
searchReactNodeSearch or filter input area on the leading edge.

ToolbarGroup

Visual grouping inside a Toolbar.

PropTypeDescription
childrenReactNode
classNamestring
idstring

Variants

PropValuesDescription
search / children / end / filters'omitted''provided'Each slot renders its wrapper only when provided; filters renders below the toolbar row.

States

StateExposed asBehaviour
Static–No state of its own; controls in the slots own their states.

Interaction behaviour

  • Arrow and Home/End keys move focus among focusable elements whose nearest toolbar is this one (nested toolbars are skipped).
  • Movement stops at the ends; it does not wrap.
  • Left/Right are ignored while a text input has focus; checkbox, radio and button inputs still move.
  • Focus is not roving-tabindex: every control stays in the Tab order.

Keyboard support

KeysAction
Arrow Right / Arrow LeftNext / previous control (not inside text inputs).
Home / EndFirst / last control, including from a text input.
TabMoves through the controls in document order.

Accessibility

Role
toolbar
Accessible name
label (required), used as aria-label.
  • The type requires label, so the toolbar always has an accessible name.

Responsive behaviour

  • The row wraps; the search slot flexes between 10rem and 24rem.
  • Trailing controls use margin-inline-start: auto and wrap under when space runs out.

Theme support

  • Layout only; colours come from the controls placed inside.

Do and don't

Do

  • Name the toolbar after what it controls ("Ticket list tools").
  • Put active filters in filters.

Don't

  • Do not nest a toolbar inside another toolbar.
  • Do not put unrelated page actions in a list toolbar.
  • FilterBar: Active filters, usually in the filters slot.
  • SearchInput: Planned search control for the search slot (wave 1).
  • PageHeader: Page-wide actions sit above the toolbar.
  • DataTable: The list the toolbar usually controls.

Dependencies

KindDepends on
npm packagesreact
Monarch componentsNone

Testing coverage

  • Has role toolbar with the given label.
  • Arrow Right, End and Home move focus; Left inside a text input stays in the input.
  • ToolbarGroup renders a labelled group.
CheckCovered
Axe in jsdomYes
Server renderingYes
Browser suitesNone yet

Tests: packages/react/src/patterns/actions/toolbar