Skip to content

Switch

Toggles a single setting on or off, with optional icons in the thumb.

import { Switch } from '@windmorph/react';

Purpose

A switch toggles a single setting on or off and takes effect immediately, like a system preference. Use a Checkbox instead when the choice is part of a form that is submitted later, or when you need an indeterminate state.

Give the switch an accessible name through its label children or an aria-label / aria-labelledby (the types enforce one).

When not to use

When the change needs confirmation or a Save action, use a Checkbox instead.

See also

  • Switch on m3.material.io: Material's own guidelines, with anatomy and specs.
  • Checkbox: Selects any number of options, with checked, unchecked and indeterminate states.