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.
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.
Mental model
Section titled “Mental model”Treat layout as a set of independent relationships:
- Region — What semantic part of the page is this, and how much space surrounds it?
- Measure — Should its content fill the viewport or stop at a maximum width?
- Flow — Do children move along one axis, wrap as a group, or occupy tracks?
- Alignment — Does content need centering or distribution within available space?
- 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.
Choose by relationship
Section titled “Choose by relationship”Start with the relationship
Choose the branch that describes the structure you need to own.
Boundary
What kind of region are you defining?
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.
Compose outside in
Section titled “Compose outside in”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:
<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 values
Section titled “Responsive values”Responsive layout props accept a direct value or a mobile-first breakpoint object:
<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:
<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:
<Box elevation="raised" className="rounded-xl border border-border-default p-5"> <Stack gap="3">...</Stack></Box>Common composition patterns
Section titled “Common composition patterns”Heading with actions
Section titled “Heading with actions”Use Cluster when the actions should stay together and wrap naturally as space narrows:
<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>Centered state inside normal flow
Section titled “Centered state inside normal flow”Let the surrounding Stack own its relationship to siblings and let Center own only the state region’s internal alignment:
<Stack gap="6"> <PageHeading /> <Center minHeight="48" padding="6"> <EmptyState /> </Center></Stack>Repeated content
Section titled “Repeated content”Use Grid when repeated items should share tracks. The item component owns its internal Stack; the parent owns only the gap between items.
<Grid columns={{ base: 1, sm: 2, xl: 4 }} gap="4"> {projects.map((project) => ( <ProjectCard key={project.id} project={project} /> ))}</Grid>Ownership boundaries
Section titled “Ownership boundaries”- Let one parent own the gap between siblings. Avoid combining parent
gapwith child margins for the same relationship. - Let
Containerown maximum width and inline gutters. Do not repeatmax-widthon 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.
Avoid unnecessary wrappers
Section titled “Avoid unnecessary wrappers”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.
Semantics
Section titled “Semantics”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.
Related foundations
Section titled “Related foundations”- Spacing defines the shared rhythm used by
gapand 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.