ToggleGroup
Select one or more options and submit their state with a form.
alpina-ui/interactive/toggle-groupUsage notes
Tab enters a group once. Arrow keys move focus, Home and End reach its edges, and pressing Space changes the focused option. Use layout="grid" for equal-width tiles with arrow navigation between rows. Provide disabledReason on unavailable options to show and announce why they cannot be selected.
When to use
Keep two or three peer display modes within reach while the same data stays on screen.
When to avoid
Use Tabs when each choice opens a separate panel of content.
Accessibility
Name the group and each toggle. Ensure a selected state remains perceptible in monochrome and check keyboard movement through the group.
| Key | Action |
|---|---|
| ← / → | Move focus between choices in a horizontal group. |
| ↑ / ↓ | Move through a vertical group or between rows in a grid. |
| Home / End | Move to the first or last enabled choice. |
| Enter / Space | Change the pressed state of the focused choice. |
Content
Use parallel one- or two-word labels. Repeat the object only in the group name.
- Use
- View: List / Grid
- Avoid
- Select an option: Default / Mode B
Copy in four languages
- German
- Ansicht7 characters
- French
- Affichage9 characters
- Italian
- Vista5 characters
- Romansh
- Vista5 characters
npx --no-install alpina add toggle-group