Overview

The Switch component is used as an alternative for the checkbox component.

Properties

PropertiesDescription
childrenThe Children prop allows users to pass other components as a property, enabling users to compose together components.
checkedThe controlled state of the switch. Must be used in conjunction with onCheckedChange.
onCheckedChangeEvent handler called when the state of the switch changes.
defaultCheckedThe state of the switch when it is initially rendered. Use when you do not need to control its state.
nameThe name of the switch. Submitted with its owning form as part of a name/value pair.
valueThe value given as data when submitted with a name.
invertLabelOrderChanges the reading order of the text and switch.
disabledWhen true, prevents the user from interacting with the switch.