Form Inputs

Toggle

A toggle button allows a user to toggle a selection on or off, for example switching between two states or modes.

A toggle button allows a user to toggle a selection on or off, for example switching between two states or modes.

Component props#

NameTypeDescription
labelstringLabel text displayed above the toggle
variant'default' | 'outline'Visual style (default: "default")
size'sm' | 'md' | 'lg'Control size (default: "md")
isSelectedbooleanControlled selected state
defaultSelectedbooleanDefault selected state
isDisabledbooleanDisables the toggle
onChange(isSelected: boolean) => voidCalled when state changes
onPressedChange(pressed: boolean, event: Event) => voidBase UI passthrough, called alongside onChange

The toggleVariants helper is exported so other components (such as ToggleGroupItem) can share the same styles.