Switch

A control that indicates whether a setting is on or off.

API reference

PropTypeDefaultResponsive
autoFocus
boolean
-No
defaultSelected
boolean
-No
className
string
-No
isDisabled
boolean
-No
isReadOnly
boolean
-No
isSelected
boolean
-No
label
string
-No
name
string
-No
onChange
(isSelected: boolean) => void
-No
onFocus
(e: FocusEvent<Target>) => void
-No
onBlur
(e: FocusEvent<Target>) => void
-No
onFocusChange
(isFocused: boolean) => void
-No
onKeyDown
(e: KeyboardEvent) => void
-No
onKeyUp
(e: KeyboardEvent) => void
-No
onHoverStart
(e: HoverEvent) => void
-No
onHoverEnd
(e: HoverEvent) => void
-No
onHoverChange
(isHovered: boolean) => void
-No
style
CSSProperties
-No
value
string
-No

Examples

Disabled

A switch can be disabled using the isDisabled prop.

<Switch isDisabled />