Examples
Documentation
Toggle group props
Parameters accepted by
{#include components/forms/toggle-group ... /}. Model mode: pass
toggleGroup=<ToggleGroup> built in Java instead — the Java tab on each example
shows the builder. The ToggleGroup model generates the items; in param mode they are hand-rendered in the slot (each
item is a pf-v6-c-toggle-group__item wrapping a button with
aria-pressed and an optional pf-m-selected modifier).
| Name | Type | Description |
|---|---|---|
* id
|
String | DOM id on the container. |
ariaLabel
|
String | Group-level accessible name (since the group has role="group"). |
slot content
|
Qute block | Toggle items — see examples for the structure. |
Usage
Selection state is consumer-driven. The runtime template only renders the container. Use Alpine (as
shown in the examples) or server-side rendering with pf-m-selected +
aria-pressed="true" on the active button.
Vs. Radio / Checkbox. Use toggle-group when the choice is visually a "button bar" — view mode, alignment, formatting toggles. Use radios in forms where you submit a value.