Skip to content

React Toolbar

A glass React toolbar that groups related controls behind a single tab stop, moved through with the arrow keys.

npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/toolbar.json

Glass catches the light.

  • Toolbar
  • ToolbarLink
  • ToolbarGroup
  • ToolbarInput
  • ToolbarButton
  • +7 more
  • +4 more

Text editor

Tab into the toolbar once, then use the arrow keys (Home and End jump). The disabled Redo stays focusable so it can be discovered. Try the formatting on the paragraph below.

Glass works when it stays readable: a blur strong enough to quiet the backdrop, a rim of light to give it an edge, and text that keeps its contrast whatever passes behind.

Files to copy

7 folders · 9 files · 4 packages
From theme/src/
  • components/toolbar/
  • components/kbd/
  • components/tooltip/
  • hooks/{use-controllable.ts, use-latest.ts, use-media-query.ts, use-preferences.ts}
  • motion/tokens.ts
  • lib/{cn.ts, form.ts, popup-motion.ts, warn-once.ts}
  • styles/
shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/toolbar.jsonRegistry item: toolbar. The styles need the Tailwind v4 glass UI setup.
The examples also use
  • components/drawer/parts/sheet.tsx
  • components/menu/
  • components/status-icons/
  • lib/{glide-highlight.tsx, popup-a11y.ts}
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/menu.json
Packages
pnpm add @base-ui/react clsx motion tailwind-merge

Floating selection toolbar

variant="floating" is a glass pill for selection menus and canvases.

Liquid glass bends the light behind it. Keep the text readable by layering a tinted, near-opaque surface under every label.

Vertical tool palette

Up and Down move between tools; the tooltips open to the side.

Select tool

Zoom 100%

Narrow screens

overflow="scroll" keeps one row that scrolls sideways inside the toolbar; the default wraps onto more rows. Both stay inside their container at 320px.

Toolbar

PropTypeDefaultDescription
orientation"horizontal" | "vertical""horizontal"Sets the layout direction of the toolbar and its arrow-key navigation.
variant"glass" | "plain" | "floating""glass""glass" panel (default), "floating" pill for selection / canvas toolbars, or "plain" (no surface).
sizeToolbarSize"md"Control height: "sm" (32px) or "md" (36px, default).
overflow"wrap" | "scroll""wrap"Horizontal toolbars on narrow screens: wrap onto more rows (default), or scroll sideways in one row.
classNamestringNoneAdds a class name to the toolbar element.
contentClassNamestringNoneoverflow="scroll" only: the scrolling row inside the toolbar.
loopFocusbooleantrueArrow keys wrap from the last control to the first.
disabledbooleanfalseDisables every control in the toolbar.
aria-labelstringNoneName of the toolbar (required when there is more than one).

ToolbarButton / ToolbarToggle

PropTypeDefaultDescription
tooltipReactNodeNoneTooltip text. For an icon-only control it also becomes the accessible name (unless aria-label is set).
shortcutstringNoneKeyboard shortcut shown in the tooltip, e.g. "mod+b". Also set as aria-keyshortcuts.
tooltipSide"top" | "bottom" | "left" | "right""top" ("right" in a vertical toolbar)Which side the tooltip opens on.
iconOnlybooleanNoneSquare button for a lone icon. Detected automatically for a single element child.
classNamestringNoneAdds extra classes to the button.
disabledbooleanfalseDimmed but still focusable.
renderReactElementNoneToolbarButton: render as a popup trigger, e.g. <MenuTrigger />.
valuestringNoneNames the ToolbarToggle inside a ToolbarToggleGroup.
pressed / defaultPressed / onPressedChangeboolean / boolean / (pressed) => voidNoneToolbarToggle on its own.

ToolbarToggleGroup

PropTypeDefaultDescription
multiplebooleanfalseWhen false only one item in the group can be pressed. If any item in the group becomes pressed, the others will become unpressed. When true multiple items can be pressed.
requiredbooleanfalseSingle choice: one option always stays pressed (pressing the pressed one again does nothing), e.g. text alignment or the active tool.
classNamestringNoneExtra classes for the group.
value / defaultValuestring[]NoneValues of the buttons that are pressed (controlled or initial).
onValueChange(value: string[]) => voidNoneCalled with the new pressed values.
aria-labelstringNoneName of the group, e.g. “Alignment”.
PropTypeDefaultDescription
ToolbarGrouparia-label, disabledNoneA labeled cluster of controls.
ToolbarSeparatorclassNameNoneDraws a hairline between clusters, perpendicular to the toolbar.
ToolbarSpacerclassNameNonePushes what follows to the far end.
ToolbarLinkhref, renderNoneA link in the arrow-key order (render your router's Link).
ToolbarInputinput propsNoneA text field; at most one, as the last control. 16px text on touch screens.

Keyboard

KeysAction
Tab/Shift + TabEnter or leave the toolbar once (one tab stop).
Arrow Left/Arrow Right (Up/Down when vertical)Move between controls.
Home/EndJump to the first / last control (also from a disabled control; in a text field the keys move the caret).
Enter/SpacePress a button or toggle.

Accessibility

  • role="toolbar" with roving focus (Base UI): name it with aria-label and set orientation to match.
  • Toggles use aria-pressed; a toolbar toggle group is role="group" and needs its own aria-label.
  • tooltip and shortcut add a tooltip and aria-keyshortcuts; an icon-only button needs a tooltip or aria-label.

All exports on this page

  • Toolbar — Toolbar: a row (or column) of related controls with ONE tab stop (Base UI Toolbar).
  • ToolbarButton — A button in the toolbar's arrow-key order.
  • ToolbarGroup — A labelled cluster of controls (aria-label it, e.g.
  • ToolbarInput — A text field in the toolbar (e.g.
  • ToolbarLink — A link in the toolbar's arrow-key order, e.g.
  • ToolbarSeparator — A hairline between clusters; vertical in a horizontal toolbar and vice versa.
  • ToolbarSpacer — Pushes what follows to the far end of the toolbar (a flexible, empty gap).
  • ToolbarToggle — A pressable toggle (aria-pressed).
  • ToolbarToggleGroup — A set of toggles inside a toolbar.

When to use Toolbar

  • Use it as an editor toolbar for a rich-text editor's formatting row, where Tab enters once and arrow keys move between Bold, Italic, alignment and menu buttons instead of tabbing through twenty controls. It is an accessible toolbar with roving tabindex: Tab enters it once and the arrow keys move between the controls.
  • Use variant="floating" for a selection toolbar over text or a canvas, a glass pill that appears next to the thing being edited.
  • Use orientation="vertical" for a tool palette in a design or whiteboard app, where Up and Down move between tools and tooltips open to the side.
  • Skip it for a handful of unrelated buttons in a page header; plain Buttons are simpler there, and Menubar fits an application's File and Edit menus with dropdowns.
  • Pair it with Menu through ToolbarButton's render prop, Tooltip text already built in through the tooltip prop, and Kbd to show a shortcut such as mod+b.

Frequently asked questions

67 components pages in all: browse them on All components.

By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .