Skip to content
THE COMPONENT LIBRARY
Skip to content

Component reference

SegmentedControl

Switch between a few mutually exclusive views.

Preview

Live preview

Changes apply to this preview only.

board

Width adapts to the available space

More examples

Different configurations and compositions using the real Pimolu API. Each preview runs independently and follows the site appearance.

Basic

The first enabled option is selected when no value is given.

Open preview

Sizes

Enumerated from segmentedControlVariantMap: sm, md and lg.

Open preview

Width and orientation

fullWidth stretches the segments; vertical stacks them into a menu.

Open preview

Usage

Keep options short and use a Select when the list becomes long.

API reference

Generated from the public TypeScript declarations. Native HTML attributes are inherited where the component extends them; this reference includes Pimolu props and selected common native attributes.

PimoluSegmentedControlOption

Type source
PimoluSegmentedControlOption public API
NameTypeDefaultDescription
valueRequiredstring—Public Pimolu prop; see the source declaration for details.
labelRequiredReactNode—Visible content of the segment.
disabledboolean | undefinedfalsePublic Pimolu prop; see the source declaration for details.
valueRequired

string

No default extracted.

Public Pimolu prop; see the source declaration for details.

labelRequired

ReactNode

No default extracted.

Visible content of the segment.

disabled

boolean | undefined

Default: false

Public Pimolu prop; see the source declaration for details.

PimoluSegmentedControlProps

Type source
PimoluSegmentedControlProps public API
NameTypeDefaultDescription
optionsRequiredreadonly PimoluSegmentedControlOption[]—Segments, in display order.
valuestring | undefined—Controlled selected value.
defaultValuestring | undefined—Initial selected value when uncontrolled.
onValueChange((value: string) => void) | undefined—Called with the next selected value.
size"sm" | "md" | "lg" | undefined"md"Height and font size. Defaults to "md".
orientation"horizontal" | "vertical" | undefined"horizontal"Layout of the segments. Defaults to "horizontal".
fullWidthboolean | undefinedfalseStretch the segments across the container.
disabledboolean | undefinedfalseDisable the whole control.
namestring | undefined—Name of the hidden input submitted with a form.
classNamestring | undefined—Standard React/HTML attribute.
styleCSSProperties | undefined—Standard React/HTML attribute.
aria-labelstring | undefined—Defines a string value that labels the current element.
childrenReactNode—Standard React/HTML attribute.
onClickMouseEventHandler<HTMLDivElement> | undefined—Standard React/HTML attribute.
optionsRequired

readonly PimoluSegmentedControlOption[]

No default extracted.

Segments, in display order.

value

string | undefined

No default extracted.

Controlled selected value.

defaultValue

string | undefined

No default extracted.

Initial selected value when uncontrolled.

onValueChange

((value: string) => void) | undefined

No default extracted.

Called with the next selected value.

size

"sm" | "md" | "lg" | undefined

Default: "md"

Height and font size. Defaults to "md".

orientation

"horizontal" | "vertical" | undefined

Default: "horizontal"

Layout of the segments. Defaults to "horizontal".

fullWidth

boolean | undefined

Default: false

Stretch the segments across the container.

disabled

boolean | undefined

Default: false

Disable the whole control.

name

string | undefined

No default extracted.

Name of the hidden input submitted with a form.

className

string | undefined

No default extracted.

Standard React/HTML attribute.

style

CSSProperties | undefined

No default extracted.

Standard React/HTML attribute.

aria-label

string | undefined

No default extracted.

Defines a string value that labels the current element.

children

ReactNode

No default extracted.

Standard React/HTML attribute.

onClick

MouseEventHandler<HTMLDivElement> | undefined

No default extracted.

Standard React/HTML attribute.

Accessibility

  • Name the control and ensure selected state remains clear without color.
Read the accessibility guide →