Skip to main content

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 screen
  • watchlistHeader - Header in watchlist
  • popup - Modal overlays and dialogs
  • profileAlert - Alert on profile page
Surfaces answer the question: WHERE should this be shown?

Defining surfaces

Surfaces are typically enums with the PresentumSurface mixin:
That’s it! The mixin provides a key property automatically.

Production example

From a real app handling Black Friday campaigns:
See source ->

Variants

Surfaces describe where, variants describe how presentations appear:
Same surface can support multiple variants:
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:
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:
See production sequencing ->

Next steps

Payloads & Options

Create domain objects

Slots & State

Understand state structure

Guards

Control presentation logic