Switch
Turns a setting on or off at once, with no Save. Built on ui-sdk's Switch: Space and Enter flip it, and it submits with its form. SwitchRow lays out a labelled setting.
BetaReady to use. Its API can still change in a minor release; the changelog says when.
import { Switch, SwitchRow } from "@leap-crm/design-system";Playground
Change a prop and the component follows. Its code is under Props.
Switch
Props
size
disabled
SwitchRow
One email for each task, as it happens.
Props
label
description
size
disabled
Best practices
When to use it, and the rules that apply in particular places.
| Guidance | Practice |
|---|---|
| Do | Use it for a setting that takes effect at once with no Save, like email notifications for assigned tasks. |
| Do | Use SwitchRow for a setting on its own line: the label names the switch, the description says what changes, and pressing the label flips it. |
| Do | Write the label as a statement of what the switch turns on, like Email me when a task is assigned, so on and off read plainly. |
| Do | Use size="sm" in dense rows, like a table of firm settings. Both sizes extend their hit area past the track. |
| Don't | Use it inside a form that waits for Save, like a new contact form. Use Checkbox, so nothing changes before the lawyer saves. |
| Don't | Use it to pick between two named options, like Email or Phone. Use RadioGroup or SegmentedControl, which show both names. |
Props
Both also take ui-sdk's Switch props: checked, defaultChecked, onCheckedChange, disabled, readOnly, required, name, value and form.
Switch
| Prop | Type | Default | Description |
|---|---|---|---|
| size | "md" | "sm" | "md" | md (32 × 18) by default; sm (24 × 14) in dense rows. |
| className | string | — | Classes added to the root element, merged with its own. Tokens only. |
SwitchRow
| Prop | Type | Default | Description |
|---|---|---|---|
| label * | ReactNode | — | What the switch turns on, as a statement: "Email me when a task is assigned". |
| description | ReactNode | — | A quieter line under the label, saying what changes. |
Code
What the playground shows, ready to copy.
Switch
import { Switch } from "@leap-crm/design-system";
<Switch aria-label="Billable" />SwitchRow
import { SwitchRow } from "@leap-crm/design-system";
<SwitchRow
label="Email me when a task is assigned"
description="One email for each task, as it happens."
/>Keyboard
The keys it answers to. Tab moves between components, arrows move within them.
| Keys | What they do |
|---|---|
| Space | Toggles it. |
| Enter | Submits the form, and never toggles it. |





