Segmented control
One choice among a few, as a segmented row with a sliding indicator. Options from child <option> elements or data. Form-associated.
Billing period
Hobby$0Free forever
Pro$12per month
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.
API
For AI agents: this API as Markdown, or every component in llms-full.txt.
<ray-segmented-control> · RaySegmentedControl
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
value | value | string | Selected value (default: the first enabled option). | |
data | — | array | Options as strings or { value, label, disabled }. | |
name | name | string | Form field name. | |
color | color reflects | string | Indicator color (default: a raised neutral segment). | |
size | size reflects | xs | sm | md | lg | xl | sm | Height and font size. |
radius | radius | xs | sm | md | lg | xl | full | Corner radius. | |
fullWidth | full-width | boolean | Takes the whole width. | |
orientation | orientation reflects | horizontal | vertical | auto | horizontal | Direction. 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. |
disabled | disabled | boolean | Not interactive nor submitted. |
| Event | Description |
|---|---|
input | The user picked another option. |
change | The user picked another option. |
| Slot | Description |
|---|---|
| (default) | <option> elements. |
| Part | Description |
|---|---|
root | The row. |
indicator | The sliding highlight. |
control | Each option button. In a narrow container the options shrink and their labels end in an ellipsis. |
control-selected | The chosen option (also part control): ::part() takes no attribute selector. |
label | The text of each option. |