Simulates prefers-reduced-motion for the demo. Off follows your system setting.
Steps focus through the demo with ] and [. Tab, arrows, and Escape stay native so the component behaves as shipped.
A floating bar of actions, toggles, menus and fields, horizontal or upright.
npx shadcn@latest add ikislay/pixel-ui/toolbarimport { useState } from "react"import { Bold, Italic, Link } from "lucide-react"import { Toolbar, ToolbarButton, ToolbarSeparator } from "@/components/ui/toolbar"export function Demo() {const [bold, setBold] = useState(false)const [italic, setItalic] = useState(false)return (<Toolbar aria-label="Formatting"><ToolbarButton icon={<Bold />} tooltip="Bold" pressed={bold} onPressedChange={setBold} /><ToolbarButton icon={<Italic />} tooltip="Italic" pressed={italic} onPressedChange={setItalic} /><ToolbarSeparator /><ToolbarButton icon={<Link />}>Link</ToolbarButton></Toolbar>
1// Loading…
Options you can pass to customize this component.
orientationhorizontalverticalLays the bar out in a row or a column. Arrow keys and separators follow it.
sizesmmdlgActions are 28, 36 or 44 pixels tall.
variantfloatingflatA raised surface with a soft shadow, or a quiet tinted one.
collapsebooleanBelow the sm breakpoint, labelled actions show only their icon. The label stays for screen readers.
onFeedback(event: "press" | "toggle") => voidCalled at each semantic moment, for wiring sound or haptics.
ToolbarButtonComponentProps<"button"> & { icon?: ReactNode; pressed?: boolean; onPressedChange?: (pressed: boolean) => void; caret?: boolean; tooltip?: ReactNode }One action. Children become its label; without them it is a square icon button. Setting pressed makes it a toggle.
ToolbarSeparatorComponentProps<"div">A short hairline between groups, turned to suit the bar.
ToolbarInputComponentProps<"input">A borderless field that fills the spare width, for search or comments. Its placeholder and cleared text animate; control value to clear it on send.
classNamestringMerged onto the bar. Other props go to its root.
Simulates prefers-reduced-motion for the demo. Off follows your system setting.
Steps focus through the demo with ] and [. Tab, arrows, and Escape stay native so the component behaves as shipped.
1
A floating bar of actions, toggles, menus and fields, horizontal or upright.
npx shadcn@latest add ikislay/pixel-ui/toolbarimport { useState } from "react"import { Bold, Italic, Link } from "lucide-react"import { Toolbar, ToolbarButton, ToolbarSeparator } from "@/components/ui/toolbar"export function Demo() {const [bold, setBold] = useState(false)const [italic, setItalic] = useState(false)return (<Toolbar aria-label="Formatting"><ToolbarButton icon={<Bold />} tooltip="Bold" pressed={bold} onPressedChange={setBold} /><ToolbarButton icon={<Italic />} tooltip="Italic" pressed={italic} onPressedChange={setItalic} /><ToolbarSeparator /><ToolbarButton icon={<Link />}>Link</ToolbarButton></Toolbar>
1// Loading…
Options you can pass to customize this component.
orientationhorizontalverticalLays the bar out in a row or a column. Arrow keys and separators follow it.
sizesmmdlgActions are 28, 36 or 44 pixels tall.
variantfloatingflatA raised surface with a soft shadow, or a quiet tinted one.
collapsebooleanBelow the sm breakpoint, labelled actions show only their icon. The label stays for screen readers.
onFeedback(event: "press" | "toggle") => voidCalled at each semantic moment, for wiring sound or haptics.
ToolbarButtonComponentProps<"button"> & { icon?: ReactNode; pressed?: boolean; onPressedChange?: (pressed: boolean) => void; caret?: boolean; tooltip?: ReactNode }One action. Children become its label; without them it is a square icon button. Setting pressed makes it a toggle.
ToolbarSeparatorComponentProps<"div">A short hairline between groups, turned to suit the bar.
ToolbarInputComponentProps<"input">A borderless field that fills the spare width, for search or comments. Its placeholder and cleared text animate; control value to clear it on send.
classNamestringMerged onto the bar. Other props go to its root.