Toggle Group
A set of two-state buttons that can be toggled on or off.
Loading...
Features
- Full keyboard navigation.
- Supports horizontal/vertical orientation.
- Support single and multiple pressed buttons.
- Can be controlled or uncontrolled.
Import
Get started with importing the directives:
Anatomy
API Reference
Root
RdxToggleGroupDirective
Contains all the parts of a toggle group.
Prop | Default | Type |
---|---|---|
value | — | ModelSignal<undefined | string | string[]> |
type | — | InputSignal<"single" | "multiple"> |
disabled | false | InputSignalWithTransform<boolean, BooleanInput> Whether the toggle group is disabled. |
Data Attribute | Value |
---|---|
[data-orientation] | "vertical" | "horizontal" |
Item
RdxToggleGroupItemDirective
An item in the group.
Prop | Default | Type |
---|---|---|
value | — | InputSignal<string> The value of this toggle button. |
disabled | false | InputSignalWithTransform<boolean, BooleanInput> Whether this toggle button is disabled. |
Data Attribute | Value |
---|---|
[data-state] | "on" | "off" |
[data-disabled] | Present when disabled |
[data-orientation] | "vertical" | "horizontal" |
Accessibility
Uses roving tabindex to manage focus movement among items.
Keyboard Interactions
Key | Description |
---|---|
Tab | Moves focus to either the pressed item or the first item in the group. |
Space | Activates/deactivates the item. |
Enter | Activates/deactivates the item. |
ArrowDown | Moves focus to the next item in the group. |
ArrowRight | Moves focus to the next item in the group. |
ArrowUp | Moves focus to the previous item in the group. |
ArrowLeft | Moves focus to the previous item in the group. |
Home | Moves focus to the first item. |
End | Moves focus to the last item. |