Toggle
A button that stays pressed, like Billable on a time entry or Bold in an editor. Built on ui-sdk's Toggle: it says aria-pressed, and Space or Enter flips it. Off is the Outline button; on takes the tinted navy pick.
BetaReady to use. Its API can still change in a minor release; the changelog says when.
import { Toggle } from "@leap-crm/design-system";Playground
Change a prop and the component follows. Its code is under Props.
Props
children
size
icon
disabled
Best practices
When to use it, and the rules that apply in particular places.
| Guidance | Practice |
|---|---|
| Do | Use it for a button that stays pressed, like Billable on a time entry or Bold in an editor. |
| Do | Give an icon-only toggle an aria-label, like Bold, and keep that name the same pressed or not. aria-pressed says the state. |
| Do | Use sm, the default, in toolbars, and xs or md to match the buttons beside it. |
| Don't | Use a row of toggles for one choice from several, like Day, Week or Month. Use SegmentedControl, which allows only one. |
| Don't | Use it for a setting on a settings page. Use SwitchRow, which pairs the switch with its label and a description. |
Props
Also takes ui-sdk's Toggle props: pressed, defaultPressed, onPressedChange, value, disabled and focusableWhenDisabled.
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | — | What it shows inside. |
| size | "xs" | "sm" | "md" | "sm" | sm (32 px) by default, as in toolbars; xs and md follow the button ladder. |
| icon | ReactNode | — | A leading icon, or the only content of an icon toggle (which then needs `aria-label`). |
| className | string | — | Classes added to the root element, merged with its own. Tokens only. |
Code
What the playground shows, ready to copy.
import { Toggle } from "@leap-crm/design-system";
<Toggle>Billable</Toggle>Keyboard
The keys it answers to. Tab moves between components, arrows move within them.
| Keys | What they do |
|---|---|
| EnterSpace | Press the focused toggle. |







