Toggle
A headless toggle button with dual-mode support: standalone boolean binding or group selection with single and multi-select.
Usage
The Toggle component supports two modes:
Standalone mode: Use
v-modelonToggle.Rootfor simple boolean on/off stateGroup mode: Wrap in
Toggle.Groupfor single or multi-select with value-based selection
Basic Toggle
A standalone bookmark toggle with icon and label driven by v-model.
Anatomy
<script setup lang="ts">
import { Toggle } from '@vuetify/v0'
</script>
<template>
<!-- Standalone -->
<Toggle.Root>
<Toggle.Indicator />
</Toggle.Root>
<!-- Group (single select) -->
<Toggle.Group>
<Toggle.Root>
<Toggle.Indicator />
</Toggle.Root>
<Toggle.Root>
<Toggle.Indicator />
</Toggle.Root>
<Toggle.Root>
<Toggle.Indicator />
</Toggle.Root>
</Toggle.Group>
<!-- Group (multi select) -->
<Toggle.Group multiple>
<Toggle.Root>
<Toggle.Indicator />
</Toggle.Root>
<Toggle.Root>
<Toggle.Indicator />
</Toggle.Root>
<Toggle.Root>
<Toggle.Indicator />
</Toggle.Root>
</Toggle.Group>
</template>Examples
Toolbar
Use Toggle.Group with multiple to build a formatting toolbar. Each toggle operates independently — any combination can be active.
Formatting Toolbar
Multi-select bold, italic, underline, and strikethrough toggles that apply text formatting.
The quick brown fox jumps over the lazy dog. This sentence demonstrates how your formatting selections apply in real time.
View Switcher
Use Toggle.Group with mandatory for mutually exclusive options like layout switchers. The mandatory prop prevents deselecting all items.
View Switcher
Mandatory single-select toggle between grid and list views controlling layout display.
Accessibility
Toggle renders as a native <button> element with proper ARIA attributes:
| Attribute | Value | Description |
|---|---|---|
aria-pressed | true / false | Reflects the pressed state |
aria-disabled | true / absent | Present when disabled |
Group ARIA
| Attribute | Value | Description |
|---|---|---|
role | group | Identifies the toggle group |
aria-orientation | horizontal / vertical | Layout direction |
aria-disabled | true / absent | Present when group is disabled |
Keyboard
| Key | Action |
|---|---|
Space | Toggle pressed state |
Enter | Toggle pressed state (native button behavior) |
Data Attributes
| Attribute | Values | Description |
|---|---|---|
data-state | on / off | CSS styling hook for pressed state |
data-disabled | present / absent | CSS styling hook for disabled state |
data-orientation | horizontal / vertical | Group orientation (on group element) |
Toggle is not a form control. It has no name prop, no hidden input, and no form submission integration. Use Toggle for UI state (bold/italic toolbar, view switchers) and Checkbox for form data that needs to be submitted.
Yes. Standalone Toggle.Root manages a boolean v-model and works independently. Toggle.Group is only needed when you want selection coordination across multiple toggles.
Roving focus is a separate concern. Toggle.Group manages selection state. Focus management can be layered on top with a separate composable when needed.
Toggle.Root
Props
namespace
string | undefinedNamespace for context provision to children (Indicator)
Default: "v0:toggle:root"
groupNamespace
string | undefinedNamespace for connecting to parent Toggle.Group
Default: "v0:toggle:group"
modelValue
boolean | undefinedEvents
update:model-value
[value: boolean]Slots
default
ToggleRootSlotPropsToggle.Group
Props
Events
update:model-value
[value: T | T[]]Slots
default
ToggleGroupSlotPropsToggle.Indicator
Props
namespace
string | undefinedNamespace for context injection from parent Toggle.Root
Default: "v0:toggle:root"
Slots
default
ToggleIndicatorSlotProps