Skip to content
Version: XState v4

States

A state describes the machine’s status or mode, which could be as simple as Paused and Playing. A state machine can only be in one state at a time.

These states are “finite”; the machine can only move through the states you’ve pre-defined.

Create a state

Create a new target state

Each transition has a source state and a target state. To create a new target state from a source state:

  1. Select the source state.
  2. Press or drag from one of the handles on the left, right and bottom sides of the selected state, and release to create a connecting transition, event and new state.

Read more about transitioning between source and target states.

Create a new child state

How to create child and parent states.

Delete a state

First, select the state you want to delete.

Using the context menu

  1. Use the triple dot icon button to open the Edit menu.
  2. Choose Delete to delete the selected state.

Using backspace

Use the Backspace key to delete the selected state.