ToggleGroup
An exclusive control with one shared moving active indicator
ToggleGroup combines mutually exclusive options into one control strip. Every item shares one moving active indicator.
Import
Loading preview…
Example
import { ToggleGroup, ToggleGroupItem } from "@downcity/ui";
export function ViewModeToggle() {
return (
<ToggleGroup defaultValue={["list"]}>
<ToggleGroupItem value="list">List</ToggleGroupItem>
<ToggleGroupItem value="grid">Grid</ToggleGroupItem>
</ToggleGroup>
);
}Useful Props
orientationspacingvariantsize
Usage Notes
- Best for 2 to 5 short options
- ToggleGroup is exclusive; use separate
Togglecontrols for independent states - Use
Tabsinstead when the control switches between content panels