Switch

Examples

Simple Switch

Copied to clipboard

Switch with no labels

Copied to clipboard

Disabled Switch




Copied to clipboard

Uncontrolled Switch




Copied to clipboard

Switch Props

The Switch component accepts the following props.

NameTypeRequiredDefaultDescription
id
string
''id for the label.
className
string
''Additional classes added to the Switch
label
string
''Text value for the label
isChecked
bool
trueFlag to show if the Switch is checked.
isDisabled
bool
falseFlag to show if the Switch is disabled.
onChange
func
() => undefinedA callback for when the Switch selection changes. (isChecked, event) => {}
aria-label
custom
''Adds accessible text to the Switch.