Layout primitives in design systems: stacks, clusters, grids and why spacing belongs to the parent
Many design systems document buttons and inputs carefully but leave layout to chance. The result is that every team hand-rolls margins, and the same screen ends up with five different gaps between elements.
Layout primitives fix this by turning common arrangements into components:
- Stack: children arranged vertically with a consistent gap.
- Inline / Cluster: children in a row that wraps when space runs out (tags, button groups).
- Grid: a responsive set of columns.
- Box / Container: padding, max-width and background.
- Sidebar or Split: two regions where one has a fixed or minimum width.
Why spacing belongs to the parent
If a button carries its own margin, it brings that margin everywhere, including places it does not fit. If instead the parent Stack says "gap: 16," the button stays neutral and the layout decides spacing. This mirrors how modern CSS works with gap on flexbox and grid, and how Figma's auto layout behaves.
Benefits
- Spacing values come from your token scale automatically.
- Designers and developers describe layouts in the same vocabulary.
- Fewer one-off CSS overrides and fewer "why is this 13px?" moments.
Watch out for
- Too many props turning a Stack into a general-purpose layout engine.
- Primitives that are so abstract nobody understands when to use which.
Does your system include layout primitives, or does each team handle spacing itself? Which primitive has been the most useful in practice?
Comments · 2
Letting the parent own spacing is how Every Layout and CSS gap changed my components. Children stop needing margin hacks.
Stack and cluster components finally made layout click for me as a beginner. I stopped fighting margin collapse.