Capítulo 12 de 17
A design system lives or dies on whether its components share a predictable, consistent API — the same prop names meaning the same thing across every component is what lets a team learn the system once and apply that knowledge everywhere.
variant (visual style: primary/secondary/ghost), size (sm/md/lg), tone or color (semantic intent: danger/warning/success) — applied identically across Button, Badge, Alert, etc.Tabs.Root/Tabs.List/Tabs.Trigger/Tabs.Content) instead of one component with a huge flat prop list — gives consumers layout/composition flexibility the monolithic version can't.asChild: escape hatches that let a consumer inject custom content or change the rendered element without forking the component — asChild (Radix/Base UI's pattern, clone props onto a custom child) and named slot props (leadingIcon, renderItem) are the two dominant approaches.defaultValue) and a controlled mode (value + onChange) is close to universal in mature component libraries — it's what lets the same component work for both simple and state-managed-elsewhere use cases.data-state) instead of JS-driven class toggling, and accessibility handled internally by default — see radix-primitives-docs and base-ui-docs for the concrete API contracts.A new component should feel like it was designed by the same person who designed the last one. If a developer has to check docs for whether this component's size prop is size or variant or sizeVariant, the API convention layer has failed.
Prefer composition (compound components, slots) over prop explosion. A component accumulating dozens of boolean/enum props to cover every layout variation is a sign it should be decomposed into composable parts instead.
color on one component, variant on another, theme on a third, all meaning roughly the same thing — forces consumers to re-learn the API per component.<Table> component with 40 boolean props trying to cover every table feature, instead of composable sub-parts (see tanstack-table-docs for the composable, headless alternative).variant/size/tone) across every component — this consistency is worth more than any individual component's cleverness.radix-primitives-docs, base-ui-docs) as reference implementations of these conventions rather than reinventing them from scratch.size/tone props are usually thin wrappers over token values.radix-primitives-docs, base-ui-docs, shadcn-ui-docs: concrete, production-grade examples of these API conventions.