Skip to content
Version: XState v4

Final states

When a machine reaches the final state, it can no longer receive any events, and anything running inside it is canceled and cleaned up. The box with a surrounding border icon represents the final state.

A machine can have multiple final states or no final states.

In the video player below, Stopped is the final child state in the Opened state. When the video player is Stopped, the video player moves to its Closed state.

Make a state a final state

First, select the state you want to set as the final state.

On the canvas

  1. Right-click the state to open the edit menu.
  2. From the Type options, choose Final.

Using the state Details panel

  1. Select the state you want to set as the final state.
  2. Open the state Details panel from the right tool menu.
  3. From the type option, choose Final.

To set the state back as a normal state, follow the same steps and select the Normal type option.