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.
Single · one choice, can be cleared
The second one is required: the selected toggle cannot be turned off.
Multiple · any number
Raised · a row of latching keys
Change a group to see its change event.
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.
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
type | type reflects | single | multiple | single | single: choosing one turns the others off; multiple: each toggle is independent. |
value | value | string | The selected key (single) or keys (multiple: an array, or a comma-separated attribute). | |
name | name reflects | string | Form field name: the value (multiple: one entry per key). | |
required | required reflects | boolean | Needs a value; with single the selected toggle cannot be turned off. | |
disabled | disabled reflects | boolean | Disables every toggle. | |
spaced | spaced reflects | boolean | Toggles apart, each with its own corners (default: joined). | |
variant | variant reflects | subtle | outline | light | filled | raised | Variant of the toggles. | |
color | color reflects | string | Color of the toggles' on state. | |
size | size reflects | xs | sm | md | lg | xl | Size of the toggles. | |
radius | radius reflects | string | Corner radius of the toggles. | |
square | square reflects | boolean | Square toggles, for icons. |
| Event | Description |
|---|---|
change | The user changed the selection (read `value` or `values`; the toggles' own change events stop at the group). |
| Slot | Description |
|---|---|
| (default) | ray-toggle elements. |