Dinachi

Toggle Group

A set of related toggles that can enforce single or multiple selection.

View Source

#Installation

npx @dinachi/cli@latest add toggle-group

#Usage

tsx
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"

#Examples

#API Reference

PropTypeDefaultDescription
multiplebooleanfalseWhen true, multiple items can be pressed simultaneously
valuestring[]Controlled array of pressed toggle values
defaultValuestring[]Initial pressed values for uncontrolled usage
onValueChange(groupValue: string[], details: object) => voidCallback fired when selection changes
orientation'horizontal' | 'vertical''horizontal'The orientation of the toggle group
loopFocusbooleantrueWhether keyboard navigation should loop from last to first and vice versa
disabledbooleanfalseWhether the entire toggle group is disabled
ToggleGroupItem.variant'default' | 'outline''outline'Visual style variant for each item
ToggleGroupItem.size'default' | 'sm' | 'lg''sm'Size variant for each item