Switch API
Props, callbacks and methods. Select an underlined type to explore its fields, allowed values and callback arguments.
Switch8 props1 callbacks0 methods
Props8
| Name | Type | Description |
|---|---|---|
checkedRequired | boolean | Checked state displayed by the checkbox or switch. |
labelRequired | any | Label content or accessible name for the component, as rendered by this control. |
ariaLabelOptional | string | undefined | Accessible name announced by assistive technology. |
classNameOptional | string | undefined | Additional CSS classes applied to the component root. |
disabledOptional | boolean | undefined | Disables user interaction with the control. |
labelPositionOptional | "before" | "after" | undefined | Places the switch label before or after the control. |
titleOptional | string | undefined | Heading or title text used by this component. |
testIdOptional | string | undefined | Stable data attribute for locating the control in automated tests. |
Events and callbacks1
| Name | Type | Description |
|---|---|---|
onChangeRequired |
| Receives the new value when the user changes the control. Update the corresponding value prop for controlled use. |
Methods0
No component-specific imperative methods. Use props and callbacks to control this component.