v0.3.1 StableFoundation ComponentReact 18 & 19Zero Runtime CSS
ToggleGroup
Pressed-state actions for one or several choices.
Interactive preview
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:
| Prop | Type | Default | Description |
|---|---|---|---|
| items | {value, label, disabled?}[] | required | Unique action values. |
| multiple | boolean | false | Allow several pressed values. |
| value / defaultValue | readonly 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-groupMake 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.