Toggle button .mv-toggle (aria-pressed, variants, icon that swaps with state) and <mv-toggle-group>, single or multiple: roving tabindex, value, attached group, and a segmented control whose indicator slides between options.
Initial value (comma-separated list in multiple mode). Otherwise read from the children’s aria-pressed="true".
required
boolean
Single mode: can’t deselect everything (implied with segmented).
orientation
horizontal | vertical
horizontal
Arrow-key axis and layout.
disabled
boolean
Disables the whole group (then restores individually disabled items).
data-variant
outline | segmented
Group: attached with a border, or a segmented control with an animated indicator.
data-size
sm | lg
On the group or on a .mv-toggle.
data-variant (on .mv-toggle)
outline | accent
Style of a standalone button; accent = brand tint once pressed.
data-shape
square
Forces a square button (automatic for a button with an aria-label and a single icon).
data-mv-toggle
boolean
On a standalone .mv-toggle: toggles aria-pressed on click automatically and emits mv-change { pressed }.
value (on buttons)
string
Option identifier (otherwise data-value, otherwise the text).
Properties
Name
Type
Description
value
string | string[]
Single: string ("" if none); multiple: array.
items
HTMLElement[]
Direct child buttons.
Events
Name
Description
mv-change
Group: detail { value, item } after a user action. Standalone button (data-mv-toggle): detail { pressed }.
Content structure
Name
Description
<button class="mv-toggle" value="…">
Direct children of the group. [data-on] / [data-off] children shown according to state.
CSS classes
Name
Description
mv-toggle
Toggle button styled from aria-pressed.
mv-toggle-group-indicator
Sliding pill generated in the segmented variant.
CSS variables
Name
Default
Description
--mv-toggle-radius
var(--mv-radius-md)
Button radius.
--mv-toggle-group-radius
var(--mv-radius-lg)
Segmented control radius.
Accessibility
Real <button>s with aria-pressed (read as “toggle button, pressed”). The group has role="group" (add an aria-label) and a single tab stop: arrow keys and Home/End to navigate, Space/Enter to toggle; the tab stop lands on the pressed option. Icon buttons: aria-label required. The indicator is decorative (aria-hidden) and has no transition with reduced motion.