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>
<Toggle.Root>
<Toggle.Indicator />
</Toggle.Root>
<Toggle.Group>
<Toggle.Root />
</Toggle.Group>
</template>Examples
The quick brown fox jumps over the lazy dog. Toggle the marks above to restyle this preview in real time.
Accessibility
Toggle renders as a native <button> element with proper ARIA attributes:
| Attribute | Value | Description |
|---|---|---|
aria-pressed | true / false | Reflects the pressed state |
disabled | present / absent | Native <button> host (the default) when disabled |
aria-disabled | true / false | Non-button hosts (as is not button) |
Group ARIA
| Attribute | Value | Description |
|---|---|---|
role | group | Identifies the toggle group |
aria-orientation | horizontal / vertical | Layout direction |
aria-disabled | true / false | Boolean on the group. false stays on the attribute |
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) |
FAQ
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.
Arrow-key roving is a separate concern — Toggle.Group manages selection state, not a tab-stop ring. For programmatic focus, ToggleGroupExpose.focus() moves to the selected item (or the first if none is selected); layer useRovingFocus only if you need arrow navigation.
Hold a template ref on Toggle.Root typed as AtomExpose — ref.value?.element is the host; call .focus() on it. On Toggle.Group, type the ref as ToggleGroupExpose and call ref.value?.focus() — that focuses the selected item, or the first if none is selected. Pass DOM FocusOptions (preventScroll, focusVisible); focusVisible is pass-through only, not emulated. Renderless roots expose element: null — there is no host to focus.
<script setup lang="ts">
import { Toggle } from '@vuetify/v0'
import type { AtomExpose, ToggleGroupExpose } from '@vuetify/v0'
import { useTemplateRef } from 'vue'
const root = useTemplateRef<AtomExpose>('root')
const group = useTemplateRef<ToggleGroupExpose>('group')
</script>
<template>
<Toggle.Root ref="root" />
<Toggle.Group ref="group">
<Toggle.Root value="a" />
</Toggle.Group>
</template>