Skip to content
RefineUI

Segmented Control

Linear set of mutually exclusive options.

Overview

Machine-readable contract from Component Spec.

component: segmented-controlexport: SegmentedControlversion: 1recipe: segmented-controltokens.visual: segmentedControlattributes: data-refineui=segmented-control

Anatomy

Partdata-refineui
rootsegmented-control
indicatorsegmented-control-indicator
itemsegmented-control-item

States

ScopeCategoryValues
componentpseudofocus-visible
componentenvironmentforced-colors, dir, prefers-contrast

Accessibility

SlotElementRoleRequired attributes
segmented-controldivradiogroup—
segmented-control-itembuttonradioaria-checked: required=true, type: boolean

Keyboard

KeyActionNative
Enteractivatetrue
Spaceactivatetrue

Focus

SectionPropertyValue
visualrequiredtrue
visualselector:focus-visible
behaviorrovingtrue

Layout

PropertyValue
directionlogical
rtltrue

Variant

Select a recipe variant — preview and Recipe → Tokens update together.

Recipe → Tokens

Slot bindings for variant="selected" — declared in segmented-control.recipe.ts.

SlotVariantPropertyTraceSemanticLight → foundationDark → foundationRecipe class
root—backgroundsegmentedControl.barBackgroundbackgroundBrandSubtleprimaryLightGrayneutral800bg-refineui-alias-background-brand-subtle
root—bordersegmentedControl.barBorderborderDefaultneutral300neutral650border-refineui-alias-border-default
indicator—backgroundsegmentedControl.selectedBackgroundbackgroundBrandprimaryBlackprimaryGraybg-refineui-alias-background-brand
item—foregroundsegmentedControl.itemForegroundforegroundSecondaryneutral600neutral350text-refineui-alias-foreground-secondary
itemselectedforegroundsegmentedControl.selectedForegroundforegroundOnBrandneutralWhiteneutralBlacktext-refineui-alias-foreground-on-brand

Component token trace

All paths in token-trace-v2.json prefixed with segmentedControl.

TraceSemanticLight foundationDark foundationLightDark
segmentedControl.barBackgroundbackgroundBrandSubtleprimaryLightGrayneutral800#E6E6E6#2A2A2A
segmentedControl.barBorderborderDefaultneutral300neutral650#DBDBDB#5B5B5B
segmentedControl.hoverForegroundforegroundPrimaryprimaryBlackneutralWhite#212121#FFFFFF
segmentedControl.itemDisabledForegroundforegroundDisabledneutral400neutral600#CECECE#6C6C6C
segmentedControl.itemForegroundforegroundSecondaryneutral600neutral350#6C6C6C#D8D8D8
segmentedControl.selectedBackgroundbackgroundBrandprimaryBlackprimaryGray#212121#D4D4D4
segmentedControl.selectedDisabledBackgroundbackgroundSurfaceDisabledneutral150neutral850#F0F0F0#222222
segmentedControl.selectedForegroundforegroundOnBrandneutralWhiteneutralBlack#FFFFFF#000000
segmentedControl.selectedHoverBackgroundbackgroundBrandHoverprimaryDarkGrayprimaryLightGray#4d4d4d#E6E6E6
npm install @refineui/react @refineui/tokens
import { SegmentedControl, SegmentedControlItem } from "@refineui/react";
<SegmentedControl value={view} onValueChange={setView}>
<SegmentedControlItem value="grid">Grid</SegmentedControlItem>
<SegmentedControlItem value="list">List</SegmentedControlItem>
</SegmentedControl>

The selected thumb is a sliding brand indicator. Until geometry is ready (data-ready), the selected item keeps a brand fill so the first paint is not blank. After the first layout, transform leads width slightly so the slide feels less mechanical.

PropDefaultTypeDescription
value—stringControlled selected value.
defaultValue—stringUncontrolled initial value.
onValueChange—(value: string) => voidEvent handler when selection changes.
PropDefaultTypeDescription
value—stringUnique value for this option (required).
disabledfalsebooleanDisables this option.