Controls

Toolbar

Preview
Reduced motion

Simulates prefers-reduced-motion for the demo. Off follows your system setting.

Keyboard stepping

Steps focus through the demo with ] and [. Tab, arrows, and Escape stay native so the component behaves as shipped.

Toolbar

A floating bar of actions, toggles, menus and fields, horizontal or upright.

Installation

npx shadcn@latest add ikislay/pixel-ui/toolbar

How to use

import { 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>

Source Code

// Loading…

Props

Options you can pass to customize this component.

Prop
Type
Description
orientation
horizontalvertical

Lays the bar out in a row or a column. Arrow keys and separators follow it.

size
smmdlg

Actions are 28, 36 or 44 pixels tall.

variant
floatingflat

A raised surface with a soft shadow, or a quiet tinted one.

collapse
boolean

Below the sm breakpoint, labelled actions show only their icon. The label stays for screen readers.

onFeedback
(event: "press" | "toggle") => void

Called at each semantic moment, for wiring sound or haptics.

ToolbarButton
ComponentProps<"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.

ToolbarSeparator
ComponentProps<"div">

A short hairline between groups, turned to suit the bar.

ToolbarInput
ComponentProps<"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.

className
string

Merged onto the bar. Other props go to its root.

Controls

Toolbar

Preview
Reduced motion

Simulates prefers-reduced-motion for the demo. Off follows your system setting.

Keyboard stepping

Steps focus through the demo with ] and [. Tab, arrows, and Escape stay native so the component behaves as shipped.

Toolbar

Toolbar

A floating bar of actions, toggles, menus and fields, horizontal or upright.

Installation

npx shadcn@latest add ikislay/pixel-ui/toolbar

How to use

import { 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>

Source Code

// Loading…

Props

Options you can pass to customize this component.

Prop
Type
Description
orientation
horizontalvertical

Lays the bar out in a row or a column. Arrow keys and separators follow it.

size
smmdlg

Actions are 28, 36 or 44 pixels tall.

variant
floatingflat

A raised surface with a soft shadow, or a quiet tinted one.

collapse
boolean

Below the sm breakpoint, labelled actions show only their icon. The label stays for screen readers.

onFeedback
(event: "press" | "toggle") => void

Called at each semantic moment, for wiring sound or haptics.

ToolbarButton
ComponentProps<"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.

ToolbarSeparator
ComponentProps<"div">

A short hairline between groups, turned to suit the bar.

ToolbarInput
ComponentProps<"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.

className
string

Merged onto the bar. Other props go to its root.