Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/statelyai/xstate/llms.txt

Use this file to discover all available pages before exploring further.

XState is available as an npm package. You can install it using your preferred package manager.

Install XState

npm install xstate

Framework-specific packages

XState provides official integrations for popular frameworks:

React

npm install xstate @xstate/react

Vue

npm install xstate @xstate/vue

Svelte

npm install xstate @xstate/svelte

Solid

npm install xstate @xstate/solid

Templates

Get started quickly by forking one of these templates:

XState Template

TypeScript template with no framework

XState + React

React + TypeScript template

XState + Vue

Vue + TypeScript template

XState + Svelte

Svelte + TypeScript template

Requirements

XState has zero dependencies and works in any JavaScript environment:
  • Node.js - Version 14 or higher
  • Browsers - All modern browsers (Chrome, Firefox, Safari, Edge)
  • TypeScript - Version 5.0 or higher (optional but recommended)
XState is written in TypeScript and provides excellent type inference out of the box. We recommend using TypeScript for the best development experience.

Verify installation

You can verify that XState is installed correctly by importing it:
import { createMachine, createActor } from 'xstate';

console.log('XState is ready!');

Next steps

Quick start

Build your first state machine

Core concepts

Learn the fundamentals

Build docs developers (and LLMs) love