Design system/Components
Segmented control
A pill with two to five segments for switching the view of one thing: list or board, day or week or month. To a screen reader it's a radio group.
In codecomponents/controls.tsx (Segmented)
Live example
Tab in and use the arrow keys to move between segments; in right-to-left the left arrow goes to the next segment.
Sizes
Container
padding 3px · r 999px · bg var(--muted)Segment (md)
32px · 0 14px · 13px / 600Phone 38pxSegment (sm)
28px · 0 11px · 12pxPhone 34pxSelected
bg var(--card) · shadow 0 1px 2px + 1px ringTransition
0.18s easeRules
Do
Labels of one or two words; an icon alone only with ariaLabel.
Don't
A sentence in each segment; on phones it spills off the screen.
Do
For views.
Don't
For actions: “Delete” and “Save” are buttons.
<Segmented
ariaLabel={tr("نما")}
value={view}
onChange={setView}
options={[
{ value: "list", label: tr("فهرست"), icon: paths.list },
{ value: "board", label: tr("تخته"), icon: paths.grid },
]}
/>Related pages