Toggle Group

A toggle button that switches between on and off states.

@radix-ui/react-toggle-group

lucide-react

Installation


1

Install the following dependencies:

npx shadcn@latest add https://sbthemes.com/r/toggle-group.json

Examples


Ghost

Size

Disabled


API Reference

Root

The parent component that contains all toggle group items.

PropTypeDefault
asChildbooleanfalse
typesingle or multiplesingle
variantdefault, outline, ghostdefault
sizedefault, sm, lg'default'
disabledboolean-
Data attributeValues
[data-state]on, off
[data-disabled]Present when disabled

ToggleGroupItem

Each toggle item inside the group should be defined separately. Don’t forget to include an aria-label for accessibility.

PropTypeDefault
valuestringRequired
classNamestring-