# chakra-ui/zag architecture

> Architecture diagram of the GitHub repository chakra-ui/zag, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chakra-ui/zag
- Repository: https://github.com/chakra-ui/zag

## Overview

Zag is a headless accessible-interaction library: users pair a component state machine with a framework adapter, connect the service to normalized props, and apply those props to their own markup. The repository separates shared machine runtime, framework bindings, and a broad catalog of component behaviors. The README documents the principal usage and framework support; unsampled machine and adapter internals are represented at directory level, so their finer interactions are not asserted.

Main entry points: [`packages/frameworks`](https://github.com/chakra-ui/zag/tree/main/packages/frameworks) (Framework bindings), [`packages/machines`](https://github.com/chakra-ui/zag/tree/main/packages/machines) (Selection and input), [`packages/core/src/create-machine.ts`](https://github.com/chakra-ui/zag/blob/main/packages/core/src/create-machine.ts) (Machine runtime), [`packages/frameworks/react/src/machine.ts`](https://github.com/chakra-ui/zag/blob/main/packages/frameworks/react/src/machine.ts) (React adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Shared runtime"]
  node_machine_core["Machine runtime<br/>[create-machine.ts]"]
end

subgraph group_adapters["Framework adapters"]
  node_machine_service["Framework bindings"]
  node_react_adapter["React adapter<br/>[machine.ts]"]
  node_vue_adapter["Vue adapter<br/>[machine.ts]"]
  node_solid_adapter["Solid adapter<br/>[machine.ts]"]
  node_svelte_adapter["Svelte adapter<br/>[machine.svelte.ts]"]
  node_preact_adapter["Preact adapter<br/>[machine.ts]"]
  node_vanilla_adapter["Vanilla adapter<br/>[machine.ts]"]
end

subgraph group_selection["Selection and input"]
  node_selection_machines["Selection and input"]
  node_collection_machines["Collections and choice"]
  node_date_machines["Date controls"]
end

subgraph group_overlays["Overlays and navigation"]
  node_overlay_machines["Dialogs and overlays"]
  node_navigation_machines["Menus and navigation"]
end

subgraph group_other["Other behaviors"]
  node_feedback_machines["Feedback and presence"]
  node_layout_machines["Layout and display"]
end

node_developer(("Application developer"))
node_markup["Custom markup"]

node_developer -->|"uses adapter"| node_machine_service
node_developer -->|"chooses behavior"| node_selection_machines
node_selection_machines -->|"provides machine"| node_machine_service
node_machine_service -->|"connects props"| node_markup
node_developer -->|"authors markup"| node_markup
node_machine_core -->|"powers adapters"| node_machine_service
node_collection_machines -.->|"provides machine"| node_machine_service
node_date_machines -.->|"provides machine"| node_machine_service
node_overlay_machines -.->|"provides machine"| node_machine_service
node_navigation_machines -.->|"provides machine"| node_machine_service
node_feedback_machines -.->|"provides machine"| node_machine_service
node_layout_machines -.->|"provides machine"| node_machine_service
node_machine_service -.->|"includes binding"| node_react_adapter
node_machine_service -.->|"includes binding"| node_vue_adapter
node_machine_service -.->|"includes binding"| node_solid_adapter
node_machine_service -.->|"includes binding"| node_svelte_adapter
node_machine_service -.->|"includes binding"| node_preact_adapter
node_machine_service -.->|"includes binding"| node_vanilla_adapter

click node_machine_core "https://github.com/chakra-ui/zag/blob/main/packages/core/src/create-machine.ts"
click node_machine_service "https://github.com/chakra-ui/zag/tree/main/packages/frameworks"
click node_react_adapter "https://github.com/chakra-ui/zag/blob/main/packages/frameworks/react/src/machine.ts"
click node_vue_adapter "https://github.com/chakra-ui/zag/blob/main/packages/frameworks/vue/src/machine.ts"
click node_solid_adapter "https://github.com/chakra-ui/zag/blob/main/packages/frameworks/solid/src/machine.ts"
click node_svelte_adapter "https://github.com/chakra-ui/zag/blob/main/packages/frameworks/svelte/src/machine.svelte.ts"
click node_preact_adapter "https://github.com/chakra-ui/zag/blob/main/packages/frameworks/preact/src/machine.ts"
click node_vanilla_adapter "https://github.com/chakra-ui/zag/blob/main/packages/frameworks/vanilla/src/machine.ts"
click node_selection_machines "https://github.com/chakra-ui/zag/tree/main/packages/machines"
click node_collection_machines "https://github.com/chakra-ui/zag/tree/main/packages/machines"
click node_date_machines "https://github.com/chakra-ui/zag/tree/main/packages/machines"
click node_overlay_machines "https://github.com/chakra-ui/zag/tree/main/packages/machines"
click node_navigation_machines "https://github.com/chakra-ui/zag/tree/main/packages/machines"
click node_feedback_machines "https://github.com/chakra-ui/zag/tree/main/packages/machines"
click node_layout_machines "https://github.com/chakra-ui/zag/tree/main/packages/machines"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_machine_core toneBlue
class node_machine_service,node_react_adapter,node_vue_adapter,node_solid_adapter,node_svelte_adapter,node_preact_adapter,node_vanilla_adapter toneAmber
class node_selection_machines,node_collection_machines,node_date_machines toneMint
class node_overlay_machines,node_navigation_machines toneRose
class node_feedback_machines,node_layout_machines,node_developer,node_markup toneIndigo
```

## Components

### Shared runtime

- [Machine runtime](https://github.com/chakra-ui/zag/blob/main/packages/core/src/create-machine.ts): `packages/core/src/create-machine.ts`

### Framework adapters

- [Framework bindings](https://github.com/chakra-ui/zag/tree/main/packages/frameworks): `packages/frameworks`
- [React adapter](https://github.com/chakra-ui/zag/blob/main/packages/frameworks/react/src/machine.ts): `packages/frameworks/react/src/machine.ts`
- [Vue adapter](https://github.com/chakra-ui/zag/blob/main/packages/frameworks/vue/src/machine.ts): `packages/frameworks/vue/src/machine.ts`
- [Solid adapter](https://github.com/chakra-ui/zag/blob/main/packages/frameworks/solid/src/machine.ts): `packages/frameworks/solid/src/machine.ts`
- [Svelte adapter](https://github.com/chakra-ui/zag/blob/main/packages/frameworks/svelte/src/machine.svelte.ts): `packages/frameworks/svelte/src/machine.svelte.ts`
- [Preact adapter](https://github.com/chakra-ui/zag/blob/main/packages/frameworks/preact/src/machine.ts): `packages/frameworks/preact/src/machine.ts`
- [Vanilla adapter](https://github.com/chakra-ui/zag/blob/main/packages/frameworks/vanilla/src/machine.ts): `packages/frameworks/vanilla/src/machine.ts`

### Selection and input

- [Selection and input](https://github.com/chakra-ui/zag/tree/main/packages/machines): `packages/machines`
- [Collections and choice](https://github.com/chakra-ui/zag/tree/main/packages/machines): `packages/machines`
- [Date controls](https://github.com/chakra-ui/zag/tree/main/packages/machines): `packages/machines`

### Overlays and navigation

- [Dialogs and overlays](https://github.com/chakra-ui/zag/tree/main/packages/machines): `packages/machines`
- [Menus and navigation](https://github.com/chakra-ui/zag/tree/main/packages/machines): `packages/machines`

### Other behaviors

- [Feedback and presence](https://github.com/chakra-ui/zag/tree/main/packages/machines): `packages/machines`
- [Layout and display](https://github.com/chakra-ui/zag/tree/main/packages/machines): `packages/machines`

### Other components

- **Application developer**
- **Custom markup**

## Connections

- Application developer → Framework bindings: uses adapter (evidence: `README.md`)
- Application developer → Selection and input: chooses behavior (evidence: `README.md`)
- Selection and input → Framework bindings: provides machine (evidence: `README.md`)
- Framework bindings → Custom markup: connects props (evidence: `README.md`)
- Application developer → Custom markup: authors markup (evidence: `README.md`)
- Machine runtime → Framework bindings: powers adapters (evidence: `README.md`)
- Collections and choice → Framework bindings: provides machine
- Date controls → Framework bindings: provides machine
- Dialogs and overlays → Framework bindings: provides machine
- Menus and navigation → Framework bindings: provides machine
- Feedback and presence → Framework bindings: provides machine
- Layout and display → Framework bindings: provides machine
- Framework bindings → React adapter: includes binding
- Framework bindings → Vue adapter: includes binding
- Framework bindings → Solid adapter: includes binding
- Framework bindings → Svelte adapter: includes binding
- Framework bindings → Preact adapter: includes binding
- Framework bindings → Vanilla adapter: includes binding
