Toggle group

ray-toggle elements with one shared value: type="single" (at most one on: alignment, view mode) or "multiple" (bold / italic / underline). Joined like a button group, or spaced; arrow keys move between toggles; submitted with its form.

Source on GitHub

Single · one choice, can be cleared
Day Week Month

The second one is required: the selected toggle cannot be turned off.

Multiple · any number
B I U S M T W T F S S
Raised · a row of latching keys
Slow Normal Fast

Change a group to see its change event.

Code

API

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

<ray-toggle-group> · RayToggleGroup

Each toggle's value (else its text) is its key. variant, color, size, radius and square reach the toggles that do not set their own. One tab stop (the selected toggle); arrows, Home and End move; Space/Enter flips.

PropertyAttributeTypeDefaultDescription
typetype reflectssingle | multiplesinglesingle: choosing one turns the others off; multiple: each toggle is independent.
valuevaluestringThe selected key (single) or keys (multiple: an array, or a comma-separated attribute).
namename reflectsstringForm field name: the value (multiple: one entry per key).
requiredrequired reflectsbooleanNeeds a value; with single the selected toggle cannot be turned off.
disableddisabled reflectsbooleanDisables every toggle.
spacedspaced reflectsbooleanToggles apart, each with its own corners (default: joined).
variantvariant reflectssubtle | outline | light | filled | raisedVariant of the toggles.
colorcolor reflectsstringColor of the toggles' on state.
sizesize reflectsxs | sm | md | lg | xlSize of the toggles.
radiusradius reflectsstringCorner radius of the toggles.
squaresquare reflectsbooleanSquare toggles, for icons.
EventDescription
changeThe user changed the selection (read `value` or `values`; the toggles' own change events stop at the group).
SlotDescription
(default)ray-toggle elements.