Action
An Action represents an interactive trigger initiated by an actor on a screen.
Definition & Purpose
An Action models something an actor can initiate from a screen (e.g. clicking a submit button, pressing retry, submitting a form, or receiving a webhook event). Actions strictly belong to screens and contain one or more relation outcomes.
Action Schema & Properties
Action objects declare human labels, initiating actors, and relations:
- name (string, optional) — Human-readable trigger label (e.g. Submit Credentials).
- actor (string, optional) — ID of the actor initiating the trigger (e.g. customer).
- relations (object, REQUIRED) — Dictionary of transition outcomes keyed by relation ID.
Address Syntax & Examples
Action addresses append .actions.action_id to the owning screen address:
Address format:screen_id.actions.action_idReal-world domain address examples:- checkout.actions.retry_payment- sign_in.actions.submit_credentials- billing.actions.cancel_subscription- cancellation_review.actions.accept_retentionDirected Edge Presentation
In Canvas view, Actions render as interactive handles on screen cards. Dragging from an action handle creates relation directed edges pointing to destination screens.
Complete Valid Example
Here is a complete screen action declaring actor, label, and dual relation outcomes:
screens: checkout: name: Checkout Surface actions: retry_payment: name: Retry Failed Payment actor: customer relations: success: to: billing state: active when: Payment gateway approves card declined: to: checkout state: payment_failed when: Payment gateway declines card againWhat an Action Does NOT Mean
A UXDL Action is NOT an HTTP REST API route, NOT an onClick handler function, and NOT a Redux action object. It describes an observable user or system trigger.
Connected Primitives & Best Practices
- Actor — References the human or system participant triggering the action.
- Relation — Every action MUST declare at least one relation outcome dictionary.
- Duality — Actions should specify both success and failure/declined relations where recovery is possible.