BASE

Zag.js

Zag.js

UI library · Free

A state machine library for complex UI widget behavior: it helps share accessible interactions across React, Vue, and other adapters.

Also known as: chakra-ui/zag; zagjs; react-zag; design-system-framework

Resource illustration: Zag.js

Open resource ↗

What you can use for free

Code and local use under MIT.

Paid features and costs

Computing resources, self-hosting, and external services are paid for separately if used.

Access and limitations

Code and local use under MIT. Computing resources, self-hosting, and external services are paid for separately if used.

Use cases

  • Add accessible behavior to a complex UI widget
  • Connect machine props to interface elements and test keyboard interactions

Example workflow

A possible workflow; this is not a report of hands-on testing.

Add accessible behavior to a complex UI widget.

Before you start

  • The component's design, states, and data.
  • A compatible framework and the project's styles.

Steps

  1. Choose a widget and connect its state machine through the required framework adapter.
  2. Connect machine props to interface elements and test keyboard interactions.
  3. Configure styles and check empty, loading, and error states.

Check your result

  • The keyboard, focus indicators, and a screen reader let users complete the action.
  • The component works on a narrow screen and with long data values.

Choosing Zag.js

Add accessible behavior to a complex UI widget

Choose this when

  • Add accessible behavior to a complex UI widget
  • Connect machine props to interface elements and test keyboard interactions

Requirements

  • Install the required machine package and your framework adapter. In the React example, useMachine, connect, and normalizeProps create props to pass to the root element and every item.

Things to consider

  • Costs and limits of free use: Computing resources, self-hosting, and external services are paid for separately if used.
  • Terms of use: MIT for the code; dependencies have separate licenses.
  • Zag is headless: interaction logic does not provide ready-made styles. Keyboard/focus/ARIA logic does not establish accessibility of your final markup unless props are connected to the corresponding elements.

Frequently asked questions

What can you use for free in Zag.js?

Code and local use under MIT.

What additional costs might arise with Zag.js?

Computing resources, self-hosting, and external services are paid for separately if used.

What terms of use matter for Zag.js?

MIT for the code; dependencies have separate licenses.

How do you get started with Zag.js?

Choose a widget and connect its state machine through the required framework adapter. Connect machine props to interface elements and test keyboard interactions. Configure styles and check empty, loading, and error states.

Can one UI behavior be used across different frameworks?

The machine models interactions independently of frameworks; the README lists React, Vue, Solid, and Svelte adapters. The component has your own markup and styles; the adapter connects them to state and events.

License

MIT for the code; dependencies have separate licenses.

MIT — permissive license

You can use, modify, distribute, and sell the code, including in a closed-source commercial product. When sharing copies or substantial portions of the code, retain the license text and copyright notice. You do not need to open-source your entire project; the author provides no warranties.

License terms

Technologies and topics

  • Zag.js
  • UI
  • Development

Sources

Other resources