Searching Puzzle Pieces

Type to search Puzzle Pieces.

Button Group

A joined row of action buttons — a segmented toolbar cluster rendered from an items array. Unlike Toggle Group there is no pressed state; each button just fires @press(value).

Installation

Copy the piece into your app — it compiles with your build and the code is yours:

puzzle add piece button-group

Requires the pieces.css tokens merged into your app styles (see Introduction).

Usage

import ButtonGroup from '@/components/ui/ButtonGroup.pzl';
<ButtonGroup label="Text formatting" @press={ format } items={[ { value: 'bold', label: 'Bold', icon: BOLD, iconOnly: true }, { value: 'italic', label: 'Italic', icon: ITALIC, iconOnly: true }, { value: 'underline', label: 'Underline', icon: UNDERLINE, iconOnly: true }, ]}/>

Variants

Sizes

Icon-only

Accessibility

The wrapper is a role="group" with an aria-label (default "Actions") from the label prop, so the cluster is announced as one named toolbar.

label is always required on every item — it is the button's accessible name. For an icon-only button set iconOnly: true: the label renders sr-only and is mirrored onto the button's title, so the control keeps both a visible affordance and a screen-reader name. The rendered <svg> is aria-hidden.

Each button is relative and rises to z-10 on focus so its focus outline draws above the overlapping neighbors instead of being clipped by their borders.