Toggle Group
Installation
Usage
Arrow keys navigate enabled items with a single tab stop. Single mode allows the active item to be cleared; multiple mode keeps an array of selected values.
Single mode uses a string value and reports undefined when cleared. With type="multiple", bind a string array; clearing all selections reports an empty array. The value and onValueChange types follow the selected mode.
Examples
Single select
Multiple select
API reference
ToggleGroup.Root
Manages toggle group selection.
| Prop | Type | Default |
|---|---|---|
class | string | undefined | — |
children | Snippet<[]> | undefined | — |
disabled | boolean | undefined | false |
type | "single" | undefined | "multiple" | — |
value Bindable | string | undefined | string[] | undefined | — |
onValueChange | ((value: string | undefined) => void) | undefined | ((value: string[]) => void) | undefined | — |
ToggleGroup.Item
Defines a toggle group option.
| Prop | Type | Default |
|---|---|---|
value Required | string | — |
disabled | boolean | undefined | — |
children | Snippet<[]> | undefined | — |
class | (string & (ClassValue | null)) | undefined | — |
pnpm dlx @mielui/svelte add toggle-group