Content
- The label describes the setting when it's on.
An on/off setting that takes effect immediately.
import { … } from "@brdgapp/ui/components/switch"Switch turns a setting on or off, and the change takes effect immediately, with no Save button. The usual mistake is using it inside a form that saves later: a switch promises an instant change.
Fill with -solid
Anything with white text on a colored fill uses --primary-solid or --danger-solid. The brand --primary and --error are for text, icons and focus rings; as fills they fail contrast (white on --error is 4.41:1).
Track. 36 × 20px pill. Off: --surface-tertiary. On: --primary-solid.
Thumb. A 16px white circle that slides.
Labeled by the visible text.
Show my ICP on my profile
People who view your profile see who you want to meet.
| Rest | Focus | Disabled | |
|---|---|---|---|
| Off | |||
| On |
| State | What happens |
|---|---|
| Off | Grey track, thumb left. |
| On | Blue track, thumb right. |
| Focus visible | 2px blue ring with a 2px offset. |
| Disabled | 40% opacity. |
role="switch" with aria-checked.checked and onChange. Save the change straight away, and show if it fails.Do
Label the setting, not the action: "Show my ICP on my profile".Don't
Label it "Turn on" or "Enable".aria-label, or aria-labelledby pointing at the visible label (preferred).| Keys | Action |
|---|---|
| SpaceEnter | Flip the switch. |
Switch
The toggle, built on Base UI Switch.
| Prop | Type | Default | Description |
|---|---|---|---|
checked | boolean | — | On or off. |
onChange | (checked: boolean) => void | — | Called with the new value. |
disabled | boolean | false | Can't be changed. |
aria-label | string | — | The name, when there's no visible label. |
aria-labelledby | string | — | The id of the visible label. |
className | string | — | Layout only. |
What it's built from and where it's used, read from the code. When you change it, check these too.
Where the code still differs from the system. Follow the system, not the gap.
--surface-tertiary on white) is under the 3:1 non-text contrast guideline.--primary; the package uses --primary-solid like every other blue fill.components.md → Switch; src/components/ui/switch.tsx.