For AI agents: the complete documentation index is available at https://wallarm.github.io/design-system/llms.txt, the full documentation bundle is available at https://wallarm.github.io/design-system/llms-full.txt, and this page is available as Markdown at https://wallarm.github.io/design-system/components/segmented-control.md.

SegmentedControl

Switches between renditions of the same content, with every option visible — reach for Tabs when the sections are distinct places rather than views of one thing, and Radio when the choice is an answer a form submits. It owns no panel: it reports the chosen value and you re-render the content yourself.

Source · Storybook

Usage

import { NumericBadge } from '@wallarm-org/design-system/NumericBadge';
import { SegmentedControl, SegmentedControlItem } from '@wallarm-org/design-system/SegmentedControl';

Examples

Disabled

A disabled option stays visible rather than disappearing, so the set of choices doesn't change shape between visits.

Icons

Icons beside the labels, which helps when the options are renditions — a list against a grid — rather than categories.

Icon only

Icon-only segments for a toolbar. Each still needs an accessible name; the icon is the label only visually.

More button

An overflow trigger for the options that didn't fit. If you need this often, the choice probably wants a Select.

Many

What too many options looks like — worth seeing so the limit is a judgement rather than a rule you took on trust.

Badge

A count on a segment, for when each view holds a different number of things and the reader would otherwise have to switch to find out.

Full width

Stretches to its container, dividing the width evenly. Suits a narrow panel; in a wide one it leaves the segments floating far apart.

Controlled

Own the value when something else has to move with it, which is the usual case, since the control renders no panel of its own.

Form field

Inside Field, for when the choice really is a form answer — the case where Radio is often the better call.

Props

PropTypeDefaultDescription
titlestring | undefined
defaultCheckedboolean | undefined
autoFocusboolean | undefined
idstring | undefined
tabIndexnumber | undefined
relstring | undefined
fullWidth{ true: string; false: string; }false
valuestring | undefinedThe currently selected value
defaultValuestring | undefinedThe default selected value
onChange((value: string) => void) | undefinedCallback function called when the selection changes
data-testidstring | undefined

SegmentedControlButton

PropTypeDefaultDescription
size{ small: string; medium: string; large: string; 'inline-edit': string; }medium
loading{ true: string; }
fullWidth{ true: string; false: string; }
asChildboolean | undefined
data-testidstring | undefined
asC | undefined
titlestring | undefined
defaultCheckedboolean | undefined
defaultValuestring | number | readonly string[] | undefined
autoFocusboolean | undefined
idstring | undefined
tabIndexnumber | undefined
relstring | undefined
onChangeChangeEventHandler<T, Element> | undefined
type"button" | "submit" | "reset" | undefined
disabledboolean | undefined
namestring | undefined
valuestring | number | readonly string[] | undefined

SegmentedControlItem

PropTypeDefaultDescription
value *stringUnique value that identifies this item
disabledboolean | undefinedWhether this item is disabled
onKeyDown((event: KeyboardEvent<HTMLLabelElement>) => void) | undefined
titlestring | undefined
defaultCheckedboolean | undefined
defaultValuestring | number | readonly string[] | undefined
autoFocusboolean | undefined
idstring | undefined
tabIndexnumber | undefined
relstring | undefined
onChangeChangeEventHandler<T, Element> | undefined
htmlForstring | undefined
data-testidstring | undefined

SegmentedControlSeparator

PropTypeDefaultDescription
titlestring | undefined
defaultCheckedboolean | undefined
defaultValuestring | number | readonly string[] | undefined
autoFocusboolean | undefined
idstring | undefined
tabIndexnumber | undefined
relstring | undefined
onChangeChangeEventHandler<T, Element> | undefined
orientation{ horizontal: string; vertical: string; }
spacingcomplex
data-testidstring | undefined
decorativeboolean | undefined
mxcomplex2

Explorer