Version: XState v4
XState library
Learn about XState.
Introducing XState
XState is a JavaScript and TypeScript library for creating, interpreting, and executing finite state machines and statecharts, as well as managing invocations of those machines as actors.
Migrate to XState v5 beta
Installation
You can install XState using your favorite package manager or embed the `` directly from a CDN.
Templates
We have XState templates for TypeScript, React Typescript, Vue, Svelte, and more!
Basics
3 pages.
Actions
2 pages.
Context
States are used for handling your apps states which you know about in advance. Context is a data store that you can use to store any arbitrary values. The assign action can be used to assign values to the context, and the context can be used in any action you call.
Transitions and choices
6 pages.
Running machines
3 pages.
Deep dive: states
7 pages.
Model-based testing
10 pages.
Actors
9 pages.
TypeScript
3 pages.
Packages
7 pages.
Advanced Topics
2 pages.