Form Inputs

Switch

A switch allows a user to turn a setting on or off.

A switch allows a user to turn a setting on or off.

Disabled#

Component props#

NameTypeDescription
labelstringLabel text rendered next to the switch (children works the same way)
size'sm' | 'md'Track size (default: "md")
isSelectedbooleanControlled selected state
defaultSelectedbooleanDefault selected state
isDisabledbooleanDisables the switch
onChange(isSelected: boolean) => voidCalled when state changes
valuestring | booleanA string is forwarded to the form input as the submitted value. A boolean is a deprecated alias for isSelected — prefer isSelected.