Control segmentado con la semántica de un grupo de radios, asociado a formularios: un tirador en relieve se desliza hasta la opción seleccionada con un ligero rebote, líneas finas separan las opciones inactivas, tres tamaños y opciones de solo icono nombradas mediante tooltips.
Agente de IA con el servidor MCP de Marvelous UI: install_components({ slugs: ["segmented"], target_dir: "<absolute path>/src/marvelous", framework: "react" }).
Value of the selected option (otherwise the first enabled one). Restored on reset.
name
string
Form field name.
label
string
Accessible name of the group (or aria-label / aria-labelledby).
icons
boolean
Icon-only options: each button’s aria-label becomes a tooltip (<mv-tooltip>).
full
boolean
Full width, equal-width segments.
data-size
sm | lg
Smaller or larger track (default between the two).
disabled / readonly
boolean
Disables the whole group (also via <fieldset disabled>) or freezes it while keeping it focusable.
Properties
Name
Tipo
Descripción
value
string
Current value; setting it selects the matching option without firing events.
items
HTMLButtonElement[]
Option buttons. Buttons added or removed later are picked up.
selectedItem
HTMLButtonElement | null
Selected option.
Methods
Name
Descripción
focus()
Focuses the selected option (or the first enabled one).
Events
Name
Descripción
mv-input / mv-change
New option selected (click or arrow keys). detail: { value, item }.
Content structure
Name
Descripción
<button value>
One option per child button (text, icon or both); disabled for an unavailable option. A trailing <span class="mv-segmented-count"> shows a count ("Open 18") that is left out of the default value.
CSS classes
Name
Descripción
mv-segmented-item / -indicator
Options and gliding thumb. data-selected marks the chosen option, data-divider an idle option that shows a hairline.
mv-segmented-count
Count pill after an option's label (<span class="mv-segmented-count">18</span>); not part of the default value.
CSS variables
Name
Predeterminado
Descripción
--mv-segmented-height
var(--mv-control-sm)
Height (overrides data-size).
--mv-segmented-radius
var(--mv-radius-md)
Outer radius; the segments use this radius minus the inner padding.
Named role="radiogroup" (aria-disabled, aria-readonly), options are role="radio" with aria-checked. A single tab stop (roving tabindex); arrow keys move and select, wrapping and mirrored in right-to-left layouts, Home/End jump to the ends and disabled options are skipped; a read-only group only moves focus. In the icon variant the name comes from the aria-label and the tooltip, also shown on keyboard focus, is not announced twice. The glide follows reduced motion, hover tints only apply to fine pointers, and forced colors draw the thumb in Highlight. When the options do not fit (narrow screen, counts), the track scrolls sideways with its scrollbar hidden, keeps the selected option in view and draws the focus ring inside the option. A count is read with its option ("Open 18"): add an aria-label on the button when the number needs words ("Open, 18 orders").