Skip to content
Playground

Composition Guide

Choose and combine Zenos layout primitives by structural responsibility.

Zenos layout primitives describe one structural relationship at a time. Compose them instead of asking one component to manage page width, section rhythm, child flow, alignment, and decoration together.

Workspace overview

Product activity at a glance

Each primitive owns one relationship: page rhythm, content width, child flow, or alignment.

Active projects

18

+3 this month

Contributors

42

Across 4 teams

Deployments

126

98.7% successful

The example follows an outside-in order: Section owns the region and its padding, Container constrains the readable width, Stack creates vertical rhythm, Cluster arranges the heading and actions, and Grid adapts the summary cards to available space.

Treat layout as a set of independent relationships:

  1. Region — What semantic part of the page is this, and how much space surrounds it?
  2. Measure — Should its content fill the viewport or stop at a maximum width?
  3. Flow — Do children move along one axis, wrap as a group, or occupy tracks?
  4. Alignment — Does content need centering or distribution within available space?
  5. Surface — Does the region need elevation, a border, color, or another application treatment?

Give each relationship one owner. This keeps responsive changes local and prevents nested wrappers from fighting over the same gap, width, or alignment.

Start with the relationship

Choose the branch that describes the structure you need to own.

Boundary

What kind of region are you defining?

  • Semantic wrapper or elevation Box

    Structure without another child-layout rule

  • Centered width and gutters Container

    Readable page content on wide viewports

  • Page region and vertical rhythm Section

    Page bands, settings regions, and article parts

Flow

How should siblings relate to one another?

  • One-dimensional flow Stack

    Rows or columns with one spacing relationship

  • Wrapping row Cluster

    Actions, tags, metadata, and controls that may wrap

  • Two-dimensional tracks Grid

    Cards and dashboards aligned in rows and columns

  • Form-specific arrangement FormLayout

    Labels and controls with form-aware responsive behavior

Placement

Does content need centering within available space?

  • Center on one or both axes Center

    Empty states, loading regions, media, and compact content

Use the narrowest primitive that owns the relationship. For example, use Cluster for a toolbar that wraps; do not use Grid merely because the toolbar has several children.

Start from the largest boundary and move toward the content. Place Section outside Container when a section background or divider should span the available width while its content remains constrained:

TSX
<Section as="section" padding={{ base: "6", lg: "12" }}>  <Container size="xl">    <Stack gap="8">      <PageHeading />      <Grid columns={{ base: 1, md: 2, xl: 3 }} gap={{ base: "4", lg: "6" }}>        {content}      </Grid>    </Stack>  </Container></Section>

Reverse that order only when the section itself should be constrained. A Section inside a Container creates a narrow semantic region; a Container inside a Section creates a full-width region with constrained content.

Responsive layout props accept a direct value or a mobile-first breakpoint object:

TSX
<Cluster gap={{ base: "2", md: "4" }} justify={{ base: "start", lg: "between" }} />

base applies everywhere. Each larger breakpoint overrides it and remains active until another value replaces it. Omitted breakpoints inherit the last applicable value through CSS.

Add a breakpoint when the content needs a different relationship, not simply because another breakpoint exists. A card collection may move from one to two columns at md and remain there through 2xl; it does not need a new value at every step.

Prefer responsive props when the primitive owns the behavior:

TSX
<Grid columns={{ base: 1, md: 2 }} gap={{ base: "3", lg: "5" }} />

Use className for application-specific decoration or a layout behavior that is intentionally outside the primitive’s API:

TSX
<Box elevation="raised" className="rounded-xl border border-border-default p-5">  <Stack gap="3">...</Stack></Box>

Use Cluster when the actions should stay together and wrap naturally as space narrows:

TSX
<Cluster align="center" justify="between" gap="4">  <Stack gap="1">    <Text type="heading" size="h4">      Team members    </Text>    <Text color="subtle">Manage access to this workspace.</Text>  </Stack>  <Cluster gap="2">    <Button variant="primary">Export</Button>    <Button>Invite member</Button>  </Cluster></Cluster>

Let the surrounding Stack own its relationship to siblings and let Center own only the state region’s internal alignment:

TSX
<Stack gap="6">  <PageHeading />  <Center minHeight="48" padding="6">    <EmptyState />  </Center></Stack>

Use Grid when repeated items should share tracks. The item component owns its internal Stack; the parent owns only the gap between items.

TSX
<Grid columns={{ base: 1, sm: 2, xl: 4 }} gap="4">  {projects.map((project) => (    <ProjectCard key={project.id} project={project} />  ))}</Grid>
  • Let one parent own the gap between siblings. Avoid combining parent gap with child margins for the same relationship.
  • Let Container own maximum width and inline gutters. Do not repeat max-width on every child section.
  • Let the nearest layout primitive own alignment. Avoid pushing children into position with arbitrary margins.
  • Keep decoration on the surface that visually owns it. A border around a group belongs on the group’s Box, not on each internal layout wrapper.
  • Keep feature behavior outside generic layout components. Layout primitives should not fetch data, coordinate routes, or infer application state.

Not every primitive belongs in every composition. If a Grid already owns the relationship between cards, it does not need an extra Stack solely to exist. If a Box has no semantics, elevation, or customization role, a fragment may be clearer.

Add a wrapper when it owns a real boundary: semantics, spacing, width, alignment, responsive behavior, or decoration. Remove it when it only forwards children and duplicates a relationship already owned elsewhere.

All layout primitives use as for polymorphism and forward the selected element’s native props and ref. Choose elements from the content’s meaning: use section for a labeled thematic region, article for independently distributable content, nav for navigation, and ul or ol for a true list.

Layout appearance alone does not justify a landmark, heading, list, or interactive role. Do not add click handlers to a Box or Stack; render a native link or button when the surface is interactive. Preserve a logical heading order even when visual size changes.

  • Spacing defines the shared rhythm used by gap and padding props.
  • Breakpoints documents the mobile-first responsive scale.
  • Aspect Ratio reserves stable media geometry inside composed layouts.
  • Box adds semantic wrapping and elevation without owning child flow.