# Toggle Group > A set of toggles where one, or several, can be on at a time. Source: https://shellui.dev/docs/v0.4/components/form/toggle-group `ToggleGroup` is **new in v0.4**. It holds `ToggleGroupItem`s and tracks which are pressed: one value with `@bind-Value`, or a list with `Multiple` and `@bind-Values`. ## Installation ```bash shellui add toggle-group ``` This also installs `ToggleGroupItem`. ## Usage ### Single selection Bind a `string?` with `@bind-Value`. Pressing the active item again clears the value. ```razor Left Center Right

Alignment: @(align ?? "none")

@code { private string? align = "center"; } ``` ### Multiple selection Set `Multiple="true"` and bind a `List` with `@bind-Values`. ```razor B I U

Formats: @(formats.Count == 0 ? "none" : string.Join(", ", formats))

@code { private List formats = new() { "bold" }; } ``` ### Disabled Disable the whole group, or single items. ```razor
Day Week Month List Board Gantt
@code { private string? view = "list"; } ``` ## API Reference ### ToggleGroup | Parameter | Type | Default | Description | |-----------|------|---------|-------------| | `Multiple` | `bool` | `false` | Allow more than one pressed item | | `Value` | `string?` | `null` | The pressed item in single mode | | `ValueChanged` | `EventCallback` | - | Fires when the single value changes | | `Values` | `List` | empty | The pressed items when `Multiple` is set | | `ValuesChanged` | `EventCallback>` | - | Fires when the list changes | | `Disabled` | `bool` | `false` | Disables every item | | `Class` | `string?` | `null` | Additional CSS classes | ### ToggleGroupItem | Parameter | Type | Default | Description | |-----------|------|---------|-------------| | `Value` | `string` | `""` | The value this item represents | | `Disabled` | `bool` | `false` | Disables this item | | `ChildContent` | `RenderFragment?` | `null` | Item content | | `Class` | `string?` | `null` | Additional CSS classes | ## Accessibility - Single mode renders `role="radiogroup"` with `role="radio"` items; multiple mode renders `role="group"` with `role="checkbox"` items - `aria-checked` and `data-state` (`on` / `off`) reflect each item's state - Items are native buttons, so Tab, Enter and Space work