Switch
Switch toggles a single setting between on and off, with an immediate effect. Its track and thumb colours follow the same selection-control palette as Checkbox and Radio.
Base
Mantine + override
Mantine
Import
{ Switch } from '@mantine/core'
Source
src/themes/theme.ts
src/themes/style-overrides/switch.module.css
Usage
disabled
React
<Switch label="Varsler på e-post" defaultChecked />
Props
Only what this design system changes. Everything else is Mantine's — read the full props table there.
| Property | Type | Allowed values | Default | Description |
|---|---|---|---|---|
| — | — | — | — | Track: --mantine-color-control-track at rest, -track-hover on hover, --mantine-color-control-active (-active-hover on hover) when checked. |
| — | — | — | — | Thumb: --mantine-color-control-thumb at rest, --mantine-color-control-icon when checked. Mantine's thumb border and ::before pseudo-element are both switched off. |
| — | — | — | — | Disabled: track and thumb both drop to --mantine-color-disabled / -color — colour only, hover included. |
The label text is 14px (--mantine-font-size-sm) at every size.
Accessibility
Switch's label prop renders an associated <label> — use it rather than
placing text beside an unlabelled control. Theme-wide rules are on the
Accessibility page.