Skip to content

Switch

Switches are toggles for Boolean values.

Make sure the Switch is suitable for your use case. There may be other, more appropriate components available.

Use caseCheckboxRadioSwitchToggleButton
Confirm an input for a form submission
Select a single option from multiple choices for a form submission
Make an instantaneous, binary choice (switch a setting on or off)
Toggle an option within a toolbar
  • The color prop is not supported. Color is determined automatically based on state (e.g., checked, disabled).
  • Restyled using StrataKit’s visual language.
  • Includes full forced-colors support.

Use the defaultChecked prop to set the initial checked state. Alternatively, use the checked and onChange props to control the checked state.

  • Small: Use in compact interfaces where space is limited.
  • Medium: Default size, suitable for most use cases.
  • Use a clear, descriptive label for each Switch.
  • Use a Switch when the effect is instantaneous (no confirmation or submission is required).
  • Don’t use switches for mandatory actions. The checked state of a switch can never be invalid.
  • Don’t use one switch to change multiple settings simultaneously.
  • Don’t use switches inside a form that needs submission. Use Checkbox instead.