PeakUI

Toolbar

Groups controls with arrow key navigation

Usage

import {Toolbar} from "@peakui/react";

Examples

Vertical

With Button Groups

Attached

Customization

Tailwind CSS

<Toolbar aria-label="Actions" className="gap-4">
  <Button>Save</Button>
</Toolbar>

Global CSS

@layer components {
  .toolbar {
    --toolbar-gap: calc(var(--spacing) * 3);
  }

  .toolbar--attached {
    --toolbar-bg: var(--color-overlay);
  }
}

Styling Reference

PeakUI follows the BEM methodology, so variants and states are plain class names you can target.

CSS Classes

The Toolbar component uses these CSS classes (view source styles):

Base & Orientation Classes

  • .toolbar - Base styles, laid out as a row
  • .toolbar--horizontal - Controls in a row (default)
  • .toolbar--vertical - Controls in a column

Modifier Classes

  • .toolbar--attached - Raised panel with padding around the controls

Slots

  • [data-slot="toolbar"]

CSS Variables

VariablePurpose
--toolbar-gapSpace between controls
--toolbar-paddingPadding of the attached panel
--toolbar-bgBackground of the attached panel

API Reference

Toolbar

PropTypeDefaultDescription
orientation'horizontal' | 'vertical''horizontal'Arranges the controls and sets the arrow keys; a Separator or ToggleButtonGroup inside follows it
isAttachedbooleanfalseWraps the controls in a raised panel
aria-labelstring-Names the toolbar; required unless aria-labelledby is set
childrenReact.ReactNode | (values: ToolbarRenderProps) => React.ReactNode-Controls to group, or a function of the toolbar's state
classNamestring | (values: ToolbarRenderProps) => string-Additional classes, or a function of the toolbar's state
renderDOMRenderFunction<'div', ToolbarRenderProps>-Replaces the rendered element. It must still return a <div>
...restToolbarProps-Every other React Aria Toolbar prop

Render Props

PropTypeDescription
orientation'horizontal' | 'vertical'The orientation of the toolbar

On this page