Skip to content
Haze UI

Toolbar

Groups slotted buttons and links into a toolbar with a single tab stop and directional keyboard navigation.

pnpm dlx shadcn@latest add @haze/toolbar
Open preview in a new tab
Livesmall script

When to use

  • Several related actions appear side by side in an editor or workspace.
  • Users should be able to move between tools without adding many Tab stops.

When not to use

  • The controls include text fields that rely on arrow keys for editing.

Installation

Add the Haze registry to components.json once, then install Toolbar with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/toolbar
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
labelstringWorkspace toolsAccessible name for the toolbar.
orientation"horizontal" | "vertical"horizontalLayout and arrow-key direction.
classstring–Classes for the toolbar wrapper.

Keyboard interactions

Tab
Reach the current tool.
Arrow keys
Move among tools along the toolbar’s axis.
HomeEnd
Focus the first or last available tool.

Accessibility

  • Add data-toolbar-item to each button or link that joins the keyboard group.
  • Unenhanced controls keep their native Tab order. Disabled controls are skipped by arrows.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • Install and use

    Install the Haze UI component "Toolbar" with `npx shadcn@latest add @haze/toolbar`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import Toolbar from "@/components/haze/ui/toolbar.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/ui/toolbar.md

  • Customize with real content

    Adapt the Haze toolbar ui for our product. Replace the demo values of these props with our real content: label, orientation, class. Keep the layout, the heading level rules and these accessibility details: Add data-toolbar-item to each button or link that joins the keyboard group. Unenhanced controls keep their native Tab order. Disabled controls are skipped by arrows. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using toolbar, check it fits: use it when several related actions appear side by side in an editor or workspace.; users should be able to move between tools without adding many tab stops.. Avoid it when the controls include text fields that rely on arrow keys for editing.. Alternatives: @haze/button-group, @haze/menu-bar, @haze/toggle-group.

Dependencies

  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog