Genesis
@beta

Toolbar

Grouped controls that behave as one tab stop — roving tabindex, arrow/Home/End.

Toolbar — a grouped set of controls that behaves as ONE tab stop. This is a primitive, not a layout, and the distinction is the whole reason it wraps Radix instead of a `<div className="flex gap-1">`. Radix's Toolbar owns a roving tabindex: Tab moves into and out of the whole group, and Arrow/Home/End move between the items inside it. A layout, by the framework's own definition, "positions things without knowing what they are" — this one knows its children are focusable controls and manages their focus, so it fails that test and passes the primitive one. `orientation` is passed to BOTH Radix (which uses it to decide whether Left/Right or Up/Down are the navigation keys) and the CVA class (which uses it to decide the flex direction). Splitting those would let the visual axis and the keyboard axis disagree — arrows moving "down" a row of buttons.

packages/ui/src/components/ui/toolbar.tsx

Import
Subpath export: @marktiderman/genesis-ui
import { Toolbar } from "@marktiderman/genesis-ui";
Exports
Re-exported from @marktiderman/genesis-ui.
  • Toolbar
  • ToolbarButton
  • ToolbarLink
  • ToolbarSeparator
  • ToolbarToggleGroup
  • ToolbarToggleItem
Components
Auto-generated from TypeScript source via react-docgen-typescript.

toolbarVariants

PropTypeDefaultDescription
classClassValue—
classNameClassValue—
orientation"horizontal" | "vertical" | nullhorizontal

Toolbar

Toolbar — a grouped set of controls that behaves as ONE tab stop. This is a primitive, not a layout, and the distinction is the whole reason it wraps Radix instead of a `<div className="flex gap-1">`. Radix's Toolbar owns a roving tabindex: Tab moves into and out of the whole group, and Arrow/Home/End move between the items inside it. A layout, by the framework's own definition, "positions things without knowing what they are" — this one knows its children are focusable controls and manages their focus, so it fails that test and passes the primitive one. `orientation` is passed to BOTH Radix (which uses it to decide whether Left/Right or Up/Down are the navigation keys) and the CVA class (which uses it to decide the flex direction). Splitting those would let the visual axis and the keyboard axis disagree — arrows moving "down" a row of buttons.

PropTypeDefaultDescription
asChildboolean—
testIDstring—Stable test/automation selector (emitted as `data-testid`).

ToolbarButton

ToolbarButton — a button that participates in the toolbar's roving tabindex. Styling reuses `buttonVariants` rather than declaring a second button look: per the framework's "one home per concept", the question "what does a button look like?" already has an answer. Only the DEFAULTS differ — `ghost`/`sm`, because a toolbar is a dense strip of controls, not a page's primary action — and both remain overridable.

PropTypeDefaultDescription
asChildboolean—
size"default" | "sm" | "lg" | "icon" | nullsm
testIDstring—Stable test/automation selector (emitted as `data-testid`).
variant"link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | "gradient" | nullghost

ToolbarLink

ToolbarLink — an anchor inside the toolbar's roving tabindex. Kept distinct from `ToolbarButton` because the element matters: a link navigates and must stay an `<a>` for middle-click, "open in new tab" and the screen-reader link rotor. Radix also gives it the toolbar's Enter/Space handling without turning it into a button.

PropTypeDefaultDescription
asChildboolean—
testIDstring—Stable test/automation selector (emitted as `data-testid`).

ToolbarSeparator

ToolbarSeparator — a decorative divider between toolbar groups. Radix excludes it from the roving tabindex, so arrow keys skip straight over it instead of landing on a 1px line. Note the inverted axis, which is easy to get backwards: Radix gives the separator the orientation PERPENDICULAR to the toolbar's, so a horizontal toolbar contains separators with `data-orientation="vertical"`. The classes below are keyed on the separator's own orientation accordingly — a vertical separator is the tall thin rule.

PropTypeDefaultDescription
asChildboolean—

ToolbarToggleGroup

ToolbarToggleGroup — a set of pressed/unpressed controls inside a toolbar (the classic bold / italic / underline cluster).

PropTypeDefaultDescription
asChildboolean—

ToolbarToggleItem

ToolbarToggleItem — one member of a `ToolbarToggleGroup`. Reuses `toggleVariants` for the same reason `ToolbarButton` reuses `buttonVariants`: `Toggle` already answers "what does a pressed control look like?", and a second answer is how two implementations get born.

PropTypeDefaultDescription
asChildboolean—
size"default" | "sm" | "lg" | nullsm
testIDstring—Stable test/automation selector (emitted as `data-testid`).
variant"default" | "outline" | nullghost