v0.3.1 StableFoundation ComponentReact 18 & 19Zero Runtime CSS

ToggleGroup

Pressed-state actions for one or several choices.

Interactive preview

Text formatting

Usage

import { ToggleGroup } from "@devvy-ui/react";

<ToggleGroup label="Formatting" multiple items={[{ value: 'bold', label: 'Bold' }]} />

API reference

Native HTML attributes, className, style and a forwarded ref are supported. Component-specific props:

PropTypeDefaultDescription
items{value, label, disabled?}[]requiredUnique action values.
multiplebooleanfalseAllow several pressed values.
value / defaultValuereadonly string[][]Pressed values.
onValueChange(values: string[]) => void—Pressed-state callback.

Accessibility & behavior

Platform Behavior & Guidelines

Native buttons use aria-pressed. Ordinary Tab order and Enter/Space remain available. Hidden fields submit each selected value; form reset restores defaults.

Source ownership

Run npx @devvy-ui/cli init once in your React project, then add the source:

npx @devvy-ui/cli add toggle-group

Make the source yours.

Start from the canonical implementation used by the package and registry. Change the code, keep the MIT notice, and build the behavior your project needs.

ToggleGroup.tsxREACT / TSX

Edit your own copy. Downloaded source uses your changes; the component preview above uses the shipped version. Run the source installer first to include shared helpers.