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
类型
Description
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
Description
focus()
Focuses the selected option (or the first enabled one).
Events
Name
Description
mv-input / mv-change
New option selected (click or arrow keys). detail: { value, item }.
Content structure
Name
Description
<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
Description
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
Default
Description
--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. A count is read with its option ("Open 18"): add an aria-label on the button when the number needs words ("Open, 18 orders").