Toggle Group
Toggle buttons sharing a selection.
Anatomy
A Toggle Group wraps a set of Toggle parts:
<script setup>
import { Toggle } from '@shardsui/vue/toggle'
import { ToggleGroup } from '@shardsui/vue/toggle-group'
</script>
<template>
<ToggleGroup>
<Toggle value="bold" />
</ToggleGroup>
</template>Give every toggle a value — those strings are what the group's value array holds.
Examples
Multiple
Set the multiple prop to let more than one toggle stay pressed at once.
Inside a toolbar
A group nested in a Toolbar joins the toolbar's arrow-key navigation and its single tab stop. The toolbar's orientation and loopFocus apply instead of the group's, and Home / End no longer move focus. Toolbar.Root / Toolbar.Group also cascade their disabled down to the toggles.
<template>
<Toolbar.Root>
<ToggleGroup :value="['bold']">
<Toggle value="bold">Bold</Toggle>
<Toggle value="italic">Italic</Toggle>
</ToggleGroup>
<Toolbar.Separator />
<Toolbar.Button>Clear</Toolbar.Button>
</Toolbar.Root>
</template>API reference
Keyboard:
The group is one tab stop: Tab moves into it and out again, and disabled toggles are skipped.