Screen
A Screen is the primary addressable surface in UXDL, representing a page, modal, drawer, sheet, or overlay.
Definition & Purpose
A Screen represents a primary user-facing surface or viewport where an actor can view status or initiate actions. It serves as the top-level container node in the UXDL behavior graph.
Surface Types & Host Parents
UXDL classifies screen surfaces using the optional 'type' attribute:
- page — Full view or primary route surface (e.g. billing).
- modal — Overlay dialog obscuring host screen. Requires 'parent' field.
- sheet — Bottom or side drawer surface. Requires 'parent' field.
- drawer — Slide-out side panel.
- overlay — Popover or dropdown menu overlay.
- panel — Embedded sub-surface or tab container.
Address Syntax & Examples
Screen addresses use clean, lowercase snake_case identifiers:
Address format:screen_idReal-world domain address examples:- sign_in- billing- cancellation_review- checkout_modalCanvas vs Document View
In Canvas view, a Screen renders as a prominent graph card containing its nested states and action ports. In Document view, it renders as a structured section outlining metadata, states, and interactive triggers.
Complete Valid Example
Here is a complete screen definition including surface type, host parent reference, states, and actions:
screens: cancellation_review: name: Confirm Cancellation Modal type: modal parent: billing metadata: figma_url: "https://figma.com/file/abc123?node-id=402-12" states: default: Retention discount offer presented processing: Cancellation request submitted to payment gateway actions: confirm_cancel: name: Finalize Cancellation relations: cancelled: to: billing state: cancelled accept_retention: name: Accept 20% Offer relations: stay_active: to: billing state: activeWhat a Screen Does NOT Mean
A Screen is NOT a React/Next.js page component, NOT a URL path, and NOT a visual layout frame. It describes an addressable behavioral surface regardless of frontend component architecture.
Connected Primitives & Best Practices
- States — Screens contain nested variant states describing surface conditions.
- Actions — Screens contain interactive triggers available to actors.
- Naming rule — Always use unique snake_case strings (^[a-z0-9][a-z0-9_]*$). Never use spaces or uppercase letters.