Toggle Group
A control element that switches between two states, providing a binary choice.
Structure
API Reference
The root component which contains the toggle group items.
Property | Type | Description |
---|---|---|
type required prop | enum | The type of toggle group. Default: undefined |
value bindable prop | union | The value of the toggle group. If the Default: undefined |
onValueChange | function | A callback function called when the value of the toggle group changes. The type of the value is dependent on the type of the toggle group. Default: undefined |
disabled | boolean | Whether or not the switch is disabled. Default: false |
loop | boolean | Whether or not the toggle group should loop when navigating. Default: true |
orientation | enum | The orientation of the toggle group. Default: horizontal |
rovingFocus | boolean | Whether or not the toggle group should use roving focus when navigating. Default: true |
ref bindable prop | HTMLDivElement | The underlying DOM element being rendered. You can bind to this to get a reference to the element. Default: undefined |
children | Snippet | The children content to render. Default: undefined |
child | Snippet | Use render delegation to render your own element. See delegation docs for more information. Default: undefined |
Data Attribute | Value | Description |
---|---|---|
data-orientation | '' | The orientation of the toggle group. |
data-toggle-group-root | '' | Present on the root element. |
An individual toggle item within the group.
Property | Type | Description |
---|---|---|
value | string | The value of the item. Default: undefined |
disabled | boolean | Whether or not the switch is disabled. Default: false |
ref bindable prop | HTMLButtonElement | The underlying DOM element being rendered. You can bind to this to get a reference to the element. Default: undefined |
children | Snippet | The children content to render. Default: undefined |
child | Snippet | Use render delegation to render your own element. See delegation docs for more information. Default: undefined |
Data Attribute | Value | Description |
---|---|---|
data-state | enum | Whether the toggle item is in the on or off state. |
data-value | '' | The value of the toggle item. |
data-orientation | '' | The orientation of the toggle group. |
data-disabled | '' | Present when the toggle item is disabled. |
data-toggle-group-item | '' | Present on the item elements. |