Learning Design Systems Course index

Lesson 0006 · 12 minutes

Component Anatomy and API Design

A component is not just a visual block. It is a small product API with parts, rules, defaults, and escape hatches.

The tangible win

After this lesson, you should be able to design a component API that exposes product decisions, hides implementation details, and still allows real product work.

Good component API = small surface, clear intent, safe defaults, documented escape hatches.

Component anatomy

Before naming props, map the anatomy. For a text field, the parts may be:

Anatomy prevents random additions. If a requested feature has no place in the anatomy, pause and ask whether the component or the pattern is wrong.

Backend analogy: public API vs internals

A weak component exposes implementation:

<TextInput labelColor="#666" borderColor="red" marginBottom="12px" />

A stronger component exposes product meaning:

<TextInput
  label="Email"
  hint="Use your work email."
  error={emailError}
  required
/>

The system decides colors, spacing, focus rings, and error styling. The product team supplies meaning, validation, and content.

Four API design rules

RuleAskExample
Name intentDoes this prop describe product meaning?error, not redBorder.
Prefer defaultsCan correct behavior happen without extra config?Visible focus ring by default.
Limit combinationsCan impossible states be prevented?Do not allow both loading and iconOnly without a label.
Expose escape hatches carefullyIs customization controlled and documented?slot or renderAction, not arbitrary CSS first.

Practice: choose the better prop

A designer asks for an input with an error message. Which API is better?

API smell tests

Read next

Skim Carbon and Material text input docs. Notice that strong systems document anatomy, states, behavior, and usage guidance—not just visual examples.