Components
Switch
Switches toggle a single setting on or off. The change takes effect immediately.
Stable
GitHubReceive updates via email.
Anatomy
Anatomy
import {Switch} from '@staffbase/design';
<Switch />API reference
Switch
Inherits props fromBase UI Switch Root
| Name | Type | Description |
|---|---|---|
checked | boolean | The controlled checked state of the switch. Use together with onCheckedChange. |
defaultChecked | boolean | The checked state of the switch when it is initially rendered. Use when you do not need to control its state. Default: false |
onCheckedChange | (checked: boolean, event: Event) => void | Callback fired when the checked state changes. |
disabled | boolean | Whether the switch should ignore user interaction. Default: false |
readOnly | boolean | Whether the user should be unable to change the checked state. Default: false |
required | boolean | Whether the switch must be checked before an owning form can be submitted. Default: false |
name | string | Identifies the switch when a form is submitted. |
When to use
When not to use
How to use
Structure
Receive updates via email.
States
Only workspace admins can change this setting.
This setting is managed by your organization policy.
Switch groups
Receive a weekly digest by email.
Get real-time alerts on your device.
Accessibility
Content & UX copy
Do
Short noun phrases in Title Case, no ending punctuation.
Don't
Full sentences, ending punctuation, or lowercase labels.