Skip to content
tezvyn:

Composite components versus layout primitives

Source: interviewMediumHow cards are made

Summary

balancing consistency against flexibility in API design.

Key points

primitives give flexibility and composition, composites enforce consistency, choose by reuse and variation.

What's really being asked

This checks whether you understand the central design-system tension: enforcing consistency versus enabling flexibility, and how that maps to component granularity.

The full answer

Primitives such as Stack, Grid, and Box are unopinionated building blocks. They maximize flexibility and composition, keep the API small, and adapt to new layouts, but they push design and accessibility decisions onto every consumer, risking inconsistency. Composites such as UserProfileCard encode a specific pattern. They guarantee visual and behavioral consistency, speed up common work, and centralize accessibility, but they are rigid, proliferate as one-off variants accumulate, and grow the API surface and maintenance burden. The right choice depends on reuse frequency and variation: build a composite when a pattern is common and stable across products; rely on primitives when layouts vary or are still evolving. Mature systems layer both, exposing primitives plus a curated set of high-value composites.

The mistakes people make

Claiming one model is always superior. Ignoring the long-term maintenance cost of many narrow composites. Forgetting that primitives can fragment accessibility and spacing if uncontrolled.

What usually comes next

How do you stop composite components from exploding into dozens of variants? How do you keep primitives from being misused? Where do tokens fit in this layering?

A concrete example

A marketing team needs many distinct hero layouts, so primitives like Stack and Grid serve them best. Meanwhile the dashboard renders the same user summary on twenty screens, so a UserProfileCard composite ensures every instance looks and behaves identically. Offering both lets each team pick the right altitude.

Interview question

In a large design system, which situation most favors building a specific composite component over relying on generic primitives?

  • a.Any case where you want to minimize the public API surface
  • b.A common, stable pattern repeated identically across many screensCorrect
  • c.A layout pattern that varies widely and is still evolving
  • d.A one-off experimental screen built by a single team
Why?

Composites pay off when a pattern is frequent and stable, because they centralize consistency and accessibility. Evolving or one-off layouts favor flexible primitives, and composites actually grow the API surface rather than shrink it.

Just read this? Test yourself on what you have been reading.

Read the original → ariane.maze.co

Put your scrolling time to good use

Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles