Extensions

Press shift + S to search API reference.

React component

Props

interface SwitchProps extends SharedSwitchProps
aria-describedbyundefined | string

A space separated list of description element IDs.

aria-labelundefined | string

The label for the switch. Use this if the switch lacks a visible text label.

aria-labelledbyundefined | string

A space separated list of label element IDs.

classNameundefined | string

Additional class names to apply to the switch.

disabledundefined | false | true

If set to true, the user cannot interact with the switch.

idundefined | string

The ID of the switch element.

labelReact.ReactNode | string

The label node for the switch.

onChangeundefined | function (newValue: boolean) => unknown

A function to be called when the switch is toggled.

sizeControlSizeProp

The size of the switch. Defaults to default.

styleReact.CSSProperties

Additional styles to apply to the switch.

tabIndexundefined | number

Indicates if the switch can be focused and if/where it participates in sequential keyboard navigation.

valueboolean

If set to true, the switch will be switchd on.

variantSwitchVariant

The variant of the switch. Defaults to default (green).