Skip to content
Design Academy My progress

Stage 6 · Lesson 6 of 13

Component architecture and consistency

Composition, slots and avoiding one-off components.

  • Intermediate
  • 30 min
  • 3 check questions
  • Exercise: 1 h 15 min

By the end of this lesson you can

  • Structure components from smaller building blocks.
  • Use composition and slots instead of endless variants.
  • Balance flexibility, consistency and maintainability.

The idea

Component architecture is how components are built from one another. A popular way to think about it is to move from small to large: foundations (tokens), basic elements (icon, label), components (button, input), composite components (search bar, card) and patterns (filter panel, checkout form). This idea is often called atomic design.

Composition over configuration

Instead of one giant card component with 40 options, build small pieces (card container, media, header, body, actions) that can be combined. This is composition. It keeps each piece simple and lets teams create layouts the system did not predict, while staying consistent.

Slots

A slot is a placeholder inside a component where other content can go, for example the body of a modal. In design tools, slots are often a placeholder instance that can be swapped. In code, they map to "children" or named slots.

Maintainability

Nesting helps updates flow, but deep nesting makes components hard to understand and slow. Keep nesting shallow and document how pieces fit.

Why it matters in real projects

Well-architected components scale: new needs can be met by combining existing parts rather than adding special cases. Poor architecture leads to bloated components that nobody understands and a flood of one-off detached copies. Thinking like this also mirrors how developers structure code, which improves collaboration.

A realistic example

A system's card component has grown to 96 variants covering image positions, button counts and badge options. Designers struggle to find the right one and often detach it.

The team rebuilds the card as a container with slots for media, header, body and footer, plus small sub-components for each. The variant count drops to four sizes. Designers compose cards from parts, and developers map them directly to their composable card in code.

Step by step

  1. Pick a complex component

    Choose one with many variants or frequent detaching.

  2. Break it down

    Identify the smaller parts it is made from.

  3. Build the parts

    Create sub-components for each part.

  4. Add slots

    Use swappable placeholders for flexible areas.

  5. Compose examples

    Build several real layouts from the parts.

  6. Compare

    Compare complexity before and after.

Common mistakes

  • Mistake Adding a variant for every request.

    Instead Use composition and slots.

  • Mistake Very deep nesting.

    Instead Keep nesting shallow and document structure.

  • Mistake Design architecture different from code.

    Instead Agree structure with developers.

Check your understanding

Choose an answer, then check it. There is an explanation either way.

Question 1 of 3What is composition?
Show answer

Combining small parts to build larger components. Composition builds from parts.

Question 2 of 3What is a slot?
Show answer

A placeholder where other content can go. Slots allow flexible content.

Question 3 of 3What does a 96-variant card suggest?
Show answer

An architecture problem. Composition would simplify it.

Practice exercise

Exercise · about 1 h 15 min

Refactor a component

Refactor a complex component into composable parts.

Steps

  1. Choose a modal, card or list item.
  2. Break it into parts and build sub-components.
  3. Add at least one slot.
  4. Compose three different real-world examples.

Deliverable

A refactored component with three composed examples.

Self-assessment

Tick each item when it is true of your exercise. Be honest; this is for you.

4 items

Summary

  • Build components from smaller parts.
  • Prefer composition and slots to endless variants.
  • Keep nesting shallow and documented.
  • Match architecture with code.

Further reading

Third-party sources, chosen for reliability. They open in a new tab.

Your notes

Marking complete updates your course and roadmap progress.

Back to UI design and design systems Roadmap