{"slug":"toggle-group","name":"ToggleGroup","category":"Form & Input","summary":"A row of toggles with single or multiple selection.","status":"stable","since":"0.2.0","import":"import { ToggleGroup } from '@elluzion/iv-ui';","usage":["`mode=\"single\"` behaves like a segmented control; `\"none\"` only emits clicks.","Items may be strings or `{ value, label, icon, disabled }`.","Bind `value`; it is a string for single mode and an array for multiple."],"props":[{"name":"items","type":"ToggleGroupItem[]","default":"[]","description":"Toggles to render. Items may be strings or `{ value, label, icon, disabled }`.","required":false,"bindable":false},{"name":"mode","type":"ToggleGroupMode","default":"'none'","description":"Selection behaviour: one value, many values, or none.","required":false,"bindable":false},{"name":"value","type":"string | string[]","default":"mode === 'multiple' ? [] : ''","description":"Selected value(s). Bind with `bind:value`.","required":false,"bindable":true},{"name":"label","type":"string","default":"''","description":"Accessible name for the group.","required":false,"bindable":false},{"name":"size","type":"'sm' | 'md' | 'lg'","default":"'md'","description":"Control size.","required":false,"bindable":false},{"name":"orientation","type":"'horizontal' | 'vertical'","default":"'horizontal'","description":"Stacking direction.","required":false,"bindable":false},{"name":"disabled","type":"boolean","default":"false","description":"Disables interaction and applies the disabled treatment.","required":false,"bindable":false}],"events":[{"name":"change","type":"(e: CustomEvent<{ value: string | string[] }>) => void","default":null,"description":"Called with `{ value }` after a selection changes.","required":false,"bindable":false}],"snippets":[{"name":"children","type":"Snippet","default":null,"description":"Content rendered inside the component.","required":false,"bindable":false}],"types":[{"name":"ToggleGroupMode","kind":"type","code":"type ToggleGroupMode = 'single' | 'multiple' | 'none';","description":"Selection behaviour of a toggle group."},{"name":"ToggleGroupItem","kind":"type","code":"type ToggleGroupItem =\n\t| string\n\t| {\n\t\t\tvalue: string;\n\t\t\tlabel?: string;\n\t\t\ticon?: Icon;\n\t\t\tdisabled?: boolean;\n\t  };","description":"A toggle description or a plain string label."}],"manual":[],"tokens":["--iv_radius","--iv_radius-lg","--iv_radius-sm","--iv_tg-radius"],"cssHooks":["iv-checked","iv-disabled","iv-lg","iv-sm","iv-toggle","iv-toggle-group","iv-vertical"],"accessibility":{"keyboard":[["Tab","Moves focus through the toggles."],["Space / Enter","Toggles the focused item."]],"notes":["The container uses `role=\"group\"` and is named by `label`.","Each option is a button with `aria-pressed`.","Selection is never changed by arrow keys, so every item stays reachable with Tab."]},"related":[{"title":"Toggle","summary":"A pressable button that keeps a checked state.","url":"/components/toggle","kind":"Component"},{"title":"ButtonGroup","summary":"Joins related buttons into one segmented control.","url":"/components/button-group","kind":"Component"},{"title":"Tabs","summary":"Switches between panels that share one context.","url":"/components/tabs","kind":"Component"},{"title":"Button","summary":"Triggers an action or submits a form.","url":"/components/button","kind":"Component"}],"examples":[{"id":"single","title":"Single","description":"One pressed toggle; choosing another releases the first.","code":"<script lang=\"ts\">\n\timport { ToggleGroup } from '@elluzion/iv-ui';\n\n\tlet view = $state('list');\n</script>\n\n<div class=\"stack\">\n\t<ToggleGroup label=\"View\" mode=\"single\" items={['list', 'grid', 'table']} bind:value={view} />\n\t<p class=\"readout\">view: {view}</p>\n</div>\n\n<style>\n\t.stack {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\talign-items: start;\n\t\tgap: var(--iv_spacing-sm);\n\t}\n\n\t.readout {\n\t\tmargin: 0;\n\t\tfont-family: var(--iv_font-mono);\n\t\tfont-size: var(--iv_text-sm);\n\t\tcolor: var(--iv_foreground-dim);\n\t}\n</style>"},{"id":"multiple","title":"Multiple","description":"Several toggles can stay pressed at once.","code":"<script lang=\"ts\">\n\timport { ToggleGroup } from '@elluzion/iv-ui';\n\n\tlet columns = $state<string[]>(['status', 'owner']);\n</script>\n\n<div class=\"stack\">\n\t<ToggleGroup\n\t\tlabel=\"Columns\"\n\t\tmode=\"multiple\"\n\t\titems={['status', 'owner', 'updated', 'branch']}\n\t\tbind:value={columns}\n\t/>\n\t<p class=\"readout\">shown: {columns.join(', ') || '—'}</p>\n</div>\n\n<style>\n\t.stack {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\talign-items: start;\n\t\tgap: var(--iv_spacing-sm);\n\t}\n\n\t.readout {\n\t\tmargin: 0;\n\t\tfont-family: var(--iv_font-mono);\n\t\tfont-size: var(--iv_text-sm);\n\t\tcolor: var(--iv_foreground-dim);\n\t}\n</style>"},{"id":"icons","title":"Icons","description":"Items with icons keep their labels for wide layouts.","code":"<script lang=\"ts\">\n\timport { IconLayoutGrid, IconList, IconTable } from '@tabler/icons-svelte';\n\timport { ToggleGroup } from '@elluzion/iv-ui';\n\n\tlet view = $state('grid');\n\n\tconst items = [\n\t\t{ value: 'list', label: 'List', icon: IconList },\n\t\t{ value: 'grid', label: 'Grid', icon: IconLayoutGrid },\n\t\t{ value: 'table', label: 'Table', icon: IconTable }\n\t];\n</script>\n\n<ToggleGroup label=\"View\" mode=\"single\" {items} bind:value={view} />"}],"markdown":"/components/toggle-group.md","page":"/components/toggle-group"}