Actions
Toolbar
A row of buttons, toggles, inputs and links with one tab stop: the arrows move between them.
npx shadcn@latest add @fragiola/toolbarToolbar
A toolbar groups the tools of an editor, a table or a canvas behind one tab stop: Tab enters
it, the arrows move between its buttons, links and inputs (the APG toolbar; swapped in RTL, with
loopFocus), and Tab leaves it.
To join a few buttons visually, each its own tab stop and with no arrow keys, use a Button Group instead.
Composition
The toolbar adds no family; it composes what exists:
- Root is a panel (
foundation.panel): the floor's fill, alinestroke,rounded-lg, a 4px inner gap.orientation="vertical"stacks it. - Button and Link are small ghost Clickables. A tool that stays
pressed renders a Toggle:
<Toolbar.Button render={<Toggle />} />, and a set of them goes in a Toggle Group. A menu renders its trigger the same way (render={<DropdownMenu.Trigger />}). - Input is a bare field control: it carries no box (rule 3), so it goes in a
Field.RowandField.Body, like any input. - Group keeps tools that belong together a gap apart; Separator is a 1px
linerule across the toolbar.
Bases
Both bases' Toolbar have the same parts. Where they differ by design:
- a disabled Button or Input stays focusable on Base UI (
focusableWhenDisabledistruethere); on Fragiola Primitives it is skipped unless you passfocusableWhenDisabled; - a disabled Input is natively
disabledon Fragiola Primitives,aria-disabledon Base UI; - Base UI selects an Input's text on every focus; Fragiola Primitives only when the arrows move the focus to it;
- the Separator is always across the toolbar on Fragiola Primitives; Base UI's takes an
orientation.
Parts
| Part | Source |
|---|---|
Root | primitive Toolbar.Root + foundation.panel() |
Button / Link | clickable({ variant: "ghost", size: "sm" }) |
Input | field.control() |
Group | a flex row |
Separator | a line rule |