Toggle group

Segmented choices from hidden radios, without JavaScript.

Installation

Examples

Default

Each Toggle is a label around a hidden radio, so toggles that share a name choose one and a form reads the choice. The group holds them a size smaller than a Button, so in a row it takes the Button's height.

demo.tsx

Sizes

The default group is as tall as a Button, and lg as a large one.

sizes.tsx

Checkboxes

With type="checkbox", each toggle turns on and off on its own.

checkboxes.tsx

Disabled

A toggle with disabled dims and can't be chosen; on the group, disabled turns them all off.

disabled.tsx

Anatomy

Each part's data-slot, which a theme styles, is beside it.