State Machine (@state)

Coming Soon - State machine diagrams are planned for a future release.

State diagrams show the different states a system can be in and the transitions between them.

Planned Syntax

@state
[states]
  idle:Idle|initial
  loading:Loading
  ready:Ready
  error:Error
  closed:Closed|final

[transitions]
  idle->loading:start
  loading->ready:success
  loading->error:failure
  ready->loading:refresh
  error->idle:retry
  ready->closed:close
Rendered diagram

Use Cases

  • User session lifecycle

  • Order status tracking

  • Connection state management

  • Game states

  • UI component states

Planned Features

Feature
Description

Initial state

Marked with |initial

Final state

Marked with |final

Transitions

state->state:event

Guards

Conditional transitions

Actions

Entry/exit/transition actions

Nested states

Composite states

Current Alternatives

Until @state is fully implemented, you can use @flow with appropriate shapes:

Rendered diagram

Roadmap

See the Roadmap for planned release timeline.

Get Notified

Star the GitHub repositoryarrow-up-right to be notified when state diagrams are released.

Last updated