Ballmac UI home

Toolbar

A frosted macOS toolbar with a title block, icon and labeled buttons, segmented view switches, an expanding search field, separators and spacers, built on Radix Toolbar so the whole bar is one tab stop.

Showing icons. Tab enters the toolbar; arrow keys move between controls.

Installation

$ pnpm dlx shadcn@latest add @ballmac/toolbar

Usage

import { Toolbar, ToolbarButton, ToolbarGroup, ToolbarSegmented, ToolbarSegment, ToolbarSeparator, ToolbarSpacer, ToolbarSearch } from "@/components/ballmac/toolbar"

The full example is in the Code tab above.

Examples

Labeled buttons

API reference

<Toolbar>

PropTypeDefault
label*

Accessible name of the toolbar.

string—
title

Large title at the leading edge.

React.ReactNode—
subtitle

Smaller line under the title, such as an item count.

React.ReactNode—

<ToolbarButton>

PropTypeDefault
icon

Icon.

React.ReactNode—
labeled

Show the text label under the icon (the classic macOS toolbar item) instead of icon only.

booleanfalse
pressed

Shown as a pressed (toggled on) button.

boolean—

<ToolbarSearch>

PropTypeDefault
collapsedWidth

Width when collapsed, as a CSS length.

string"9rem"
expandedWidth

Width when focused or filled.

string"15rem"
onClear

Called when the clear button is pressed.

() => void—

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
TabEnters and leaves the toolbar as a single stop
ArrowLeft / ArrowRightMoves between buttons; Home and End jump to the ends
Screen readersNamed by its label; pressed buttons use aria-pressed

Use with AI

<Toolbar label title subtitle> with ToolbarButton (icon, labeled, pressed), ToolbarGroup, ToolbarSegmented + ToolbarSegment (single choice), ToolbarSeparator, ToolbarSpacer and ToolbarSearch. Arrow keys move between buttons. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Toolbar (@ballmac/toolbar) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Document and file-manager windows
  • Editors with many commands

Not for

  • Page navigation (navbar)
  • One or two buttons (button-group)

Registry JSON: https://ui.ballmac.com/r/toolbar.json

Credits

Free to use in personal and commercial projects.