Segmented control

One choice among a few, as a segmented row with a sliding indicator. Options from child <option> elements or data. Form-associated.

Source on GitHub

Billing period
Hobby$0Free forever
Team$32per month
Switch the view
  • Release notes12 KB
  • Roadmap8 KB
  • Brand kit2.4 MB
  • Invoices640 KB
  • Screenshots18 MB
  • Contracts1.1 MB
Colors, sizes and radius
Vertical, full width, and from data
Narrow containers: drag the corner of the box

orientation="auto" stacks the options when they do not fit in a row. In a box narrower than even the stack, the labels end in an ellipsis.

Code

API

For AI agents: this API as Markdown, or every component in llms-full.txt.

<ray-segmented-control> · RaySegmentedControl

PropertyAttributeTypeDefaultDescription
valuevaluestringSelected value (default: the first enabled option).
data—arrayOptions as strings or { value, label, disabled }.
namenamestringForm field name.
colorcolor reflectsstringIndicator color (default: a raised neutral segment).
sizesize reflectsxs | sm | md | lg | xlsmHeight and font size.
radiusradiusxs | sm | md | lg | xl | fullCorner radius.
fullWidthfull-widthbooleanTakes the whole width.
orientationorientation reflectshorizontal | vertical | autohorizontalDirection. auto: a row that stacks (data-stacked, aria-orientation vertical) when its options at their natural width do not fit in the room its parent gives it, and goes back to a row when they fit again.
disableddisabledbooleanNot interactive nor submitted.
EventDescription
inputThe user picked another option.
changeThe user picked another option.
SlotDescription
(default)<option> elements.
PartDescription
rootThe row.
indicatorThe sliding highlight.
controlEach option button. In a narrow container the options shrink and their labels end in an ellipsis.
control-selectedThe chosen option (also part control): ::part() takes no attribute selector.
labelThe text of each option.