Spacing
Consistent spacing for components and layout primitives.
Zenos uses a shared spacing scale to create rhythm within components and across page layouts. The scale follows a 4px base unit and provides enough range for dense controls, content groups, and large structural regions.
Layout primitives accept spacing keys instead of Tailwind utility strings. This keeps responsive props typed and makes spacing decisions consistent at every call site.
0 0px 1 4px 2 8px 3 12px 4 16px 5 20px 6 24px 8 32px 10 40px 12 48px 14 56px 16 64px 20 80px 24 96px | Range | Typical use |
|---|---|
0–2 | Hairline separation, compact icon relationships, and dense controls |
3–5 | Form fields, component content, and closely related groups |
6–10 | Cards, panels, grids, and page-level content groups |
12–24 | Major sections, spacious page regions, and large responsive boundaries |
The ranges are guidance, not component defaults. Start from the relationship between elements and use the smallest value that communicates it clearly.
Relationships before measurements
Section titled “Relationships before measurements”Spacing describes how strongly elements belong together. A label sits closer to its control than the field sits to the next field. A card title sits closer to its description than the card sits to neighboring cards.
Use consistent spacing for equivalent relationships. Avoid choosing a new value to solve every individual screen.
Layout props
Section titled “Layout props”Stack, Grid, Cluster, and FormLayout expose gap. Grid-based primitives also support independent rowGap and columnGap where the two axes need different rhythm.
<Stack gap="4"> <Header /> <Content /></Stack>Structural primitives such as Stack, Section, Center, and Layout expose typed padding props where they own the relevant boundary. Prefer those props when spacing is part of the component’s structure.
<Section padding={{ base: "4", md: "8" }} gap="6"> <Header /> <Content /></Section>Responsive spacing
Section titled “Responsive spacing”Responsive values use the shared base, sm, md, lg, xl, and 2xl breakpoints. Increase space when more room improves hierarchy; do not expand every gap automatically at each breakpoint.
<Grid columns={{ base: 1, md: 2 }} gap={{ base: "3", md: "6" }}> {children}</Grid>Object values cascade upward. In this example, 3 applies from the base viewport until md, and 6 applies from md onward.
Logical directions
Section titled “Logical directions”Use logical padding props such as inline start, inline end, block start, and block end when direction matters. Logical spacing follows the document direction automatically and works more reliably for right-to-left interfaces than physical left and right values.
See RTL for application setup, directional icons, portals, keyboard behavior, and a complete testing checklist.
Component and application spacing
Section titled “Component and application spacing”Zenos components own the internal spacing needed for their anatomy and interaction states. Consumers should compose components with layout primitives rather than reaching into internal children with fragile selectors.
Application-specific spacing remains appropriate for unique page composition:
<Box className="mt-7 lg:mt-11"> <ProductSpecificVisualization /></Box>Use className for isolated product needs. When the same relationship repeats, prefer a Zenos layout primitive with a spacing token.
Guidance
Section titled “Guidance”- Use smaller values within a component and larger values between distinct regions.
- Let one parent own the gap between siblings; avoid stacking child margins.
- Prefer
gapfor sibling relationships and padding for container boundaries. - Keep touch target size separate from visible spacing.
- Test narrow screens, 200% zoom, long labels, and translated content.
- Use
0intentionally when another visual treatment already communicates grouping.
Spacing should make relationships easier to understand. It should not compensate for unclear hierarchy or unnecessary wrappers.