Segmented Control
One choice from a few, as joined segments: Day · Week · Month. Built on ui-sdk's SegmentedControl, a radio group underneath: Tab reaches the chosen segment and the arrow keys move the choice. For switching between views with icons, use ViewSwitch.
BetaReady to use. Its API can still change in a minor release; the changelog says when.
import { SegmentedControl, SegmentedControlItem } from "@leap-crm/design-system";Playground
Change a prop and the component follows. Its code is under Props.
Props
Best practices
When to use it, and the rules that apply in particular places.
| Guidance | Practice |
|---|---|
| Do | Use it for one choice from a few short options seen side by side, like Day, Week and Month on a calendar, or a range on a report. |
| Do | Name it with aria-label, like Range. Tab reaches the chosen segment and the arrow keys move the choice. |
| Do | Use md in forms and dialogs, sm in toolbars and xs in section headers. |
| Do | Put a count after a segment's label as a child when it helps the choice, like open tasks per status. |
| Don't | Use it to switch between views of the same data, like an opportunities list and board. Use ViewSwitch, which shows the views as icons. |
| Don't | Use it for more options than fit on one line at narrow widths. Segments don't wrap or shrink; use Select. |
Props
SegmentedControl also takes ui-sdk's value, defaultValue, onValueChange, disabled, readOnly, required, name, form, loop and orientation. SegmentedControlItem takes value and disabled.
SegmentedControl
| Prop | Type | Default | Description |
|---|---|---|---|
| size | "xs" | "sm" | "md" | "md" | md 36 (forms, dialogs) by default · sm 32 (toolbars) · xs 28 (section headers). |
| className | string | — | Classes added to the root element, merged with its own. Tokens only. |
SegmentedControlItem
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | — | What it shows inside. |
| icon | ReactNode | — | A leading icon: 16 px at md, 14 px at sm and xs. |
| className | string | — | Classes added to the root element, merged with its own. Tokens only. |
Code
What the playground shows, ready to copy.
import {
SegmentedControl,
SegmentedControlItem,
} from "@leap-crm/design-system";
<SegmentedControl defaultValue="Week" aria-label="Range">
<SegmentedControlItem value="Day">Day</SegmentedControlItem>
<SegmentedControlItem value="Week">Week</SegmentedControlItem>
<SegmentedControlItem value="Month">Month</SegmentedControlItem>
</SegmentedControl>With icons
An icon leads the label: 16 px at md, 14 px at sm and xs.
What the examples share
The imports and the scaffolding the examples above call. The scaffolding lives in this page, not in the library.
import { Calendar, CalendarDays, CalendarRange } from "lucide-react";
import { Fragment } from "react";
import { SegmentedControl, SegmentedControlItem } from "@leap-crm/design-system";
const sizes = ["md", "sm", "xs"] as const;
const ranges = ["Day", "Week", "Month"] as const;Keyboard
The keys it answers to. Tab moves between components, arrows move within them.
| Keys | What they do |
|---|---|
| Tab | Lands on the checked item, and the next Tab leaves. |
| Arrow keys | Check the next item, skipping disabled ones and wrapping. |







