@zag-js/vue

The vue wrapper for zag
1,398,706 5,240
Install
npm install @zag-js/vue
Latest Version:1.47.0
Vue:3
License:MIT
Last Updated:Oct 26, 2026
Links: GitHub  ·  npm
Maintainer: segunadebayo
Zag.js

Zag

Accessible component logic for React, Vue, Solid, and Svelte.

Build dialogs, menus, comboboxes, date pickers, and more with state machines that handle keyboard interactions, focus management, and ARIA attributes. You control the markup and styling; Zag handles the behavior.

@zag-js/core monthly downloads GitHub stars Join the Zag Discord community

Documentation · Getting started · Changelog · Discord

Why Zag?

  • Bring your own design. Headless APIs give you control over the rendered elements and any styling solution.
  • Reuse behavior across frameworks. The same component machines power React, Vue, Solid, and Svelte, with adapters for Preact and vanilla JavaScript too.
  • Build on accessible interactions. Keyboard navigation, focus management, and ARIA behavior follow the WAI-ARIA authoring practices.
  • Make complex behavior predictable. State machines describe how components respond to interactions, with Playwright tests checking behavior across frameworks.

Quick start

Install a component machine and the adapter for your framework. For a React toggle group:

npm install @zag-js/toggle-group @zag-js/react

Connect the machine to your markup:

import { normalizeProps, useMachine } from "@zag-js/react"
import * as toggle from "@zag-js/toggle-group"
import { useId } from "react"

export function ToggleGroup() {
  const service = useMachine(toggle.machine, { id: useId() })
  const api = toggle.connect(service, normalizeProps)

  return (
    <div {...api.getRootProps()}>
      <button {...api.getItemProps({ value: "bold" })} aria-label="Bold">
        B
      </button>
      <button {...api.getItemProps({ value: "italic" })} aria-label="Italic">
        I
      </button>
      <button {...api.getItemProps({ value: "underline" })} aria-label="Underline">
        U
      </button>
    </div>
  )
}

Add your styles, then explore the toggle group docs for the full API and examples in other frameworks.

Framework Adapter
React @zag-js/react
Vue @zag-js/vue
Solid @zag-js/solid
Svelte @zag-js/svelte
Preact @zag-js/preact
Vanilla JavaScript @zag-js/vanilla

Contributing

Bug reports, documentation improvements, and new component ideas are welcome. Read the contributing guide for local setup, development commands, and how to submit changes.

Acknowledgments

Zag grew out of building Chakra UI and draws inspiration from Pure UI, Pure UI Control, Material Components Web, Radix UI, XState, Vue, Lit, and Sonner.

License

MIT © Chakra Systems Inc.

Related Packages

@ui-machines/vue

The vue wrapper for ui-machines

2,309 5,238
zq-vue-hook

easy create form page

313 1
vue-timer-hook

Vue 3 composition API hooks for countdown timers, stopwatches, and live clock st...

189,124
tankhooks

Vue3实用Hooks集合

550 3

Version History

Version Released Vue License
1.47.0 >=3.0.0 MIT
1.46.0 >=3.0.0 MIT
1.45.0 >=3.0.0 MIT
1.44.0 >=3.0.0 MIT
1.43.3 >=3.0.0 MIT
Pre-releases (812)
Version Released Vue License
2.0.0-next.3 >=3.0.0 MIT
2.0.0-next.2 >=3.0.0 MIT
2.0.0-next.1 >=3.0.0 MIT
2.0.0-next.0 >=3.0.0 MIT
0.0.0-v1-beta-20250222173217 >=3.0.0 MIT