Skip to content
Thrum

Toolbar

A bar of controls that act on one thing: the text being edited, the chart on screen. The whole bar is one tab stop and the arrow keys move inside it, so a long bar costs the keyboard one Tab. For commands sorted into named menus, use a menubar.

Install

npx shadcn@latest add @thrum-pro/toolbar

This is a Pro component. The command works once your project has a licence key: set up Pro or see pricing.

Props

PropTypeDefaultDescription
Toolbar: orientation"horizontal" | "vertical"Default "horizontal"The direction of the bar, and which arrow keys move along it. Groups and separators follow it.
Toolbar: loopFocusbooleanDefault trueWhether the arrow keys wrap from the last control to the first.
Toolbar: disabledbooleanDefault falseDisables every button and toggle of the bar. Links stay usable.
Toolbar: soundbooleanDefault truePlay a rising pair of clicks when a toggle is pressed and a falling pair when it is released, if the visitor has sound on.
Toolbar: classNamestring–Extra classes for the bar. It is as wide as its controls and wraps onto more lines in a narrow container.
ToolbarButton: variant"primary" | "secondary" | "outline" | "ghost" | "destructive" | "link"Default "ghost"The button variant. Keep ghost for most; primary marks the bar's one main action.
ToolbarButton: disabledbooleanDefault falseDimmed, and a press does nothing. It stays reachable with the arrow keys, so a screen reader can find it.
ToolbarButton: focusableWhenDisabledbooleanDefault trueSet false to take a disabled button out of the arrow-key order as well.
ToolbarButton: ...propsbutton props–Every other button attribute. A button with only an icon needs an aria-label.
ToolbarToggle: pressedboolean–Whether a toggle that stands alone is pressed, when the parent holds the state. Use it with onPressedChange.
ToolbarToggle: defaultPressedbooleanDefault falseWhether a toggle that stands alone starts pressed.
ToolbarToggle: onPressedChange(pressed: boolean) => void–Called with the new state when the toggle is pressed or released.
ToolbarToggle: valuestring–Inside a ToolbarToggleGroup: what the group's value holds while this toggle is pressed.
ToolbarToggle: variant"default" | "outline"Default "default"default has no frame until it is pressed. outline always shows its border.
ToolbarToggleGroup: valuereadonly string[]–The values of the pressed toggles, when the parent holds them. Use it with onValueChange.
ToolbarToggleGroup: defaultValuereadonly string[]Default []The values pressed at first, when the group holds its own state.
ToolbarToggleGroup: onValueChange(value: string[]) => void–Called with the new list when a toggle is pressed or released.
ToolbarToggleGroup: multiplebooleanDefault falseLet several toggles be pressed at once. Without it, pressing one releases the other.
ToolbarGroup: disabledbooleanDefault falseDisables every button inside the group.
ToolbarGroup: ...propsdiv props–Buttons that belong together. Name the group with an aria-label.
ToolbarSeparatordiv props–A line between groups, drawn across the bar's direction.
ToolbarLinkanchor props–A link on the bar. The arrow keys reach it like a button.

Motion and sound

Motion

  • A control's fill and text colour change over 150 ms on hover and when a toggle is pressed or released.
  • A press scales the control to 97% and back over 150 ms.
  • Reduced motion: colours and scale change at once.

Sound

  • A rising pair of clicks when a toggle is pressed and a falling pair when it is released.
  • Buttons and links are silent.

Sound is off until the visitor turns it on. Pass sound={false} to keep this component silent. How sound works

Accessibility

  • It follows the WAI-ARIA toolbar pattern: the bar has the toolbar role and its controls share one tab stop.
  • Name the bar with an aria-label, and every group and toggle group too. An icon-only control needs an aria-label of its own.
  • A toggle is a button with aria-pressed. Pressed is the primary fill with the primary text colour against an empty box, so the state does not rest on a tint.
  • A disabled control keeps its place in the arrow-key order and says it is disabled, so the bar's shape does not change under a screen reader.
  • Every control is 32 pixels tall and at least 32 wide, above the 24 pixel minimum target.
  • In a container narrower than its controls the bar wraps onto more lines. Under a glass material the bar is translucent, and its tint keeps the text at 4.5 to 1.
KeysAction
TabMove onto the bar, onto the control that last had the focus, and out again. The bar is one tab stop.
← / →Move to the previous or next control of a horizontal bar. Past the end it wraps. In right-to-left text the keys swap.
↑ / ↓Move to the previous or next control of a vertical bar.
Enter / SpacePress the focused button or toggle. Enter follows the focused link.

Source

SourcePro

The source comes with Pro

TypeScript source · Copy-paste ready · MIT-compatible for client projects · Includes all dependencies

Files and dependencies

Adds
components/ui/toolbar.tsx
Packages
@base-ui/react@1.9.0
Brings along
ButtonToggleToggle group

Changelog

  1. 1.0.0 · 2026-12-03First release.

Loading index…

Keyboard shortcuts

/Ctrl KSearch components, docs and actions
?Show this list
AAppearance studio
SSound on or off
MFull or reduced motion
TTheme: auto, light, dark
GSurface: solid or frosted
BBackdrop photograph (under glass)
CCorner radius: square to round
RReplay the demo, on a component page
DDraw new data, on a component page
←→HomeEndMove the cursor in a focused chart
EscClose a dialog, or leave a chart cursor