The team was rebuilding the same UI pieces on every feature. A card here, a filter row there, a table with slightly different sorting each time. Nothing was broken, exactly. It was just that every new screen cost more than it should, and the product looked like five different products.
So we built a component library. Feature development time came down by roughly 20%, and the product got more consistent. But the part worth writing down is not the library. It is what made it get used, and what nearly killed it.
What made it get used
It shipped with the patterns, not just the components. A <Card> is easy. The valuable part was the rule: page layout is a header, a filter bar, a content region; cards live in a grid with fixed gaps; the page never sets its own margins. Once that was written down, a new screen was assembled instead of designed from scratch.
It was boring on purpose. No variants for every future need. Three sizes, two weights, one way to do a destructive action. Every option you add is a decision the next developer has to make, and decisions are what slow people down.
The first consumer was the team's own busiest screen. We did not build it in a vacuum and announce it. We rebuilt the screen everyone hated, with the library, and shipped it. After that it was not a mandate, it was the obvious way to work.
What nearly killed it
The prop explosion. Someone needed a card with a slightly different padding, so a padding prop appeared. Then bordered, then compact, then compactBordered. Six months later the component had fourteen boolean props and nobody could predict what any combination looked like.
The fix was a rule: a variant is a named thing (variant="compact"), not a boolean, and a new variant needs a use case that appears three times.
No owner. A library with no owner becomes a museum. Someone has to say no to the fourth variation, review the addition, and delete what nobody uses. That is a real job, and it is usually an hour a week, not a full-time role.
Documentation that was a Storybook nobody opened. What people actually needed was not every prop, but "which of these do I use for this screen". Three examples per component, showing real product screens, did more than the full prop table.
What I would do differently
- Design tokens first. Colors, spacing, type scale as variables before the first component. Retrofitting tokens into 40 components is a month of work.
- Separate layout primitives from feature components.
Stack,Grid,PageHeaderare stable for years.OrderSummaryCardis not, and it does not belong in the shared package. - Measure the thing you claimed. We said it made features faster, and it did, but we only had the before-and-after from one quarter. A simple time-to-ship per feature would have told us when the library started costing more than it saved.
The rule that kept it alive
Every component in the library has to be used in at least two places, owned by someone, and boring. The moment it needs a prop to serve one screen, that screen gets its own component instead.
A component library pays back in consistency first, speed second. The speed comes from the patterns you enforce with it, not from the components themselves.