Component API Design
The props a component exposes determine whether it gets used correctly or forked, which is the main failure mode of design systems.
Definition
A component's API is the set of properties, slots and events it exposes. It encodes which variations are supported and, by omission, which are not. Getting it wrong produces either rigidity that causes forking or flexibility that dissolves consistency.
Craft convention. True because the industry converged on it. Breaking it costs familiarity, not correctness.
On this page
Principles
- Prefer composition to configuration. A card with slots beats a card with twenty props.
- Constrain variants to a defined set rather than accepting arbitrary values. variant="primary" not colour="#0055ff".
- Do not expose a style escape hatch by default. Once one exists, it becomes the path of least resistance.
- Make the accessible path the default. If a prop can produce an inaccessible result, reconsider the prop.
- Name props for meaning, not implementation: tone, emphasis, size, rather than colour codes.
- Provide sensible defaults so the common case needs no configuration at all.
Continue from here
Each link says what the connection is, so you can tell a principle from an alternative from a thing people mix this up with.
Principles behind this
The reasoning this solution is an application of.
- Consistency and StandardsHeuristic
Often used with
These usually appear in the same screen or the same decision.
Practical example
A worked decision where this was the deciding factor.
Short definition
The one-paragraph version, for when that is all you need.
- Atomic DesignTerm
- ComponentTerm
- Component LibraryTerm
- Container QueryTerm
- Semantic VersioningTerm
Related concept
Connected closely enough to change how you apply this.
- Design System to DocumentationAI workflow
- Component Anatomy, States and VariantsDesign system
- Contribution ModelsDesign system
- Design System AdoptionDesign system
- Design System DocumentationDesign system
- Design System GovernanceDesign system
- Design TokensDesign system
- ThemingDesign system
- Versioning and DeprecationDesign system
- ContainersUI foundation
- RepetitionUI foundation
- SimilarityUI foundation
- Visual StatesUI foundation