What are surfaces?
A surface is a named location in your UI where presentations can appear. Think of them as “slots” where content gets inserted. Examples:homeTopBanner- Banner at top of home screenwatchlistHeader- Header in watchlistpopup- Modal overlays and dialogsprofileAlert- Alert on profile page
Defining surfaces
Surfaces are typically enums with thePresentumSurface mixin:
key property automatically.
Production example
From a real app handling Black Friday campaigns:Variants
Surfaces describe where, variants describe how presentations appear:PresentumOption is generic and must be extended with a concrete implementation.
For example, create CampaignOption extends PresentumOption<CampaignSurface, CampaignVariant>.Surface naming
Choose descriptive names that indicate location, not content:- ✅ Good names
- ❌ Bad names
Why location-based? Surfaces should be reusable.
homeTopBanner can show
campaigns, tips, or alerts. campaignBanner artificially limits it.Accessing surfaces
In guards and outlets, surfaces are type-safe:Surface organization
Group related surfaces:Surface independence
Each surface has its own slot. They don’t interfere unless your guards coordinate them:Coordinating surfaces
Guards can coordinate multiple surfaces:Next steps
Payloads & Options
Create domain objects
Slots & State
Understand state structure
Guards
Control presentation logic