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
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.
View Switcher
Use Toggle.Group with mandatory for mutually exclusive options like layout switchers. The mandatory prop prevents deselecting all items.
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.