Skip to main content
The Switch component renders a pill-shaped toggle that flips a single setting on or off. It is Status: Draft and is backed by Mantine’s Switch primitive. Clementine exports it from @clementine-ds/ui with the Clementine theme applied.

When to use

  • The change takes immediate effect — no Save button is required (e.g., enabling dark mode, toggling a notification preference, activating a feature flag).
  • You have a single binary setting to control.
  • The interface context makes “on/off” semantics self-evident.

When not to use

  • Form submissions where the user sets a value and then clicks Submit — use Checkbox instead. Switch implies instant effect; Checkbox implies pending form state.
  • Multiple related binary options shown together — consider a Checkbox group to keep affordances consistent.
  • Mutually exclusive options from a set — use Radio or Select.

Usage

Import Switch from @clementine-ds/ui.

Uncontrolled

Controlled

With on/off inner labels

Use onLabel and offLabel to show text inside the track for added clarity.

Disabled state


Props

SwitchProps extends Mantine’s SwitchProps, which itself extends the native <input type="checkbox"> element. All standard HTML input attributes are forwarded to the underlying input.

Interaction states

The thumb animates between positions on state change. The transition completes in 200 ms or less, in line with the Clementine motion spec.

Accessibility

  • The underlying element is <input type="checkbox" role="switch">. The role="switch" attribute communicates the on/off semantics to assistive technologies, distinct from a standard checkbox.
  • aria-checked is automatically managed by the browser based on the checked state of the underlying input.
  • Always provide a label prop or an aria-label attribute. An unlabeled switch is not announced usefully by screen readers.

Draft status. The Switch component is currently Draft. Verify aria-checked is correctly exposed by the underlying Mantine implementation and that the thumb animation completes within the required 200 ms threshold before shipping to production.