API ergonomics
How easy and pleasant a component's props and structure are to use correctly, and how hard they are to misuse.
In more detail
Ergonomic APIs have few, well-named props, sensible defaults and types that reject invalid combinations. Composition and variants usually beat boolean flags on ergonomics.
Related terms
- API — A defined way for one program to ask another program to do something, such as a list of web requests a service accepts.
- variant — A named option of a component, such as intent primary or danger and size sm or lg, each mapped to its own styling.
- composition — Building a component out of smaller components that the consumer assembles, instead of configuring one big component with flags.
Taught in
- Component API Ergonomics: Composition vs Boolean Config Props — Design Systems & Component Engineering
- Polymorphism & Slotted Composition: The asChild Pattern — Design Systems & Component Engineering