How to audit a component library
A practical pass over what you already have, so you can see what to keep, merge and promote.

Zander Whitehurst
9 min read
Most component libraries are a drawer someone kept adding to. A button, then a primary button, then a green pill that is also a button, then a card for wallets and another card for the same wallet because the first one was hard to find. Six months later the team argues about which one to use, and new work quietly builds a seventh.
An audit is how you stop. You list what exists, you watch what is actually used, and you sort every piece into a level so the next component has an obvious home. I run one before any visual refresh. Refreshing a messy library just gives you a prettier mess.
Start with an inventory, and make it dull
Open the code and the design file and write down every component, once. Name, where it lives, and a one line description of what it renders. Resist improving anything while you do this. The inventory is a photograph.
Pull the usage count from the repo. A component with forty call sites is a product surface. A component with two is either new, abandoned, or someone’s side path. All three are useful to know, and only the count tells them apart.
Do the same pass in Figma. The interesting rows are the ones that exist on only one side. A frame named Button / Destructive with no code equivalent means design has a variant engineering never received. A GreenPill in code with no frame means someone solved a ticket in the editor and moved on.
Look for the same thing wearing different names
Lay the inventory out and group by what the component renders, ignoring the name. Buttons with buttons. Badges with pills and tags. Cards with panels.
Within each group, ask three questions:
- Do they share the same anatomy? A label, an icon, a surface.
- Do they share the same props, or could they, if someone had designed the props as one list?
- Does any of them know about a specific product concept, like a wallet, a plan or a transaction?
The third question is the one that changes the structure. Button knows how to look like a button. WalletCard knows what a wallet is. They do not belong in the same folder, and they should not be maintained with the same rules. That split is the whole point of the four levels.
Give every row a decision
Each component leaves the audit with one of five decisions. Write it down. A spreadsheet with a blank decision column is a list, and it will still be a list next quarter.
| Decision | When to use it |
|---|---|
| Keep | It is used, its name is honest, and its API is small |
| Merge | Another component already does this job |
| Promote | The name only makes sense in your product, so it belongs one level up |
| Demote | It pretends to be a pattern and is really one foundation with extra padding |
| Remove | Nothing imports it, and nothing in design references it |
Promote and demote are the decisions people skip, and they are the ones that fix structure. GreenPill is a badge that learned a colour. Demote it: it becomes Badge with tone="success". DashboardFlag is a flag that learned a product area. Promote it: the flag stays generic, and the dashboard composes it inside a feature component called MetricHeader. If the name only makes sense inside your app, it is already telling you it sits too low.
Remove is safe when the usage count is zero and you have checked both code and design. Archive the file. Mention it in the pull request. Teams forgive a deleted duplicate faster than they forgive a library they cannot search.
Sort what remains into levels
Once the duplicates are gone, place every survivor:
Read the stack from the inside out.
- Foundation. The smallest single purpose piece. Badge, avatar, button, flag, icon, link. Stateless, and happy to be dropped into a different product tomorrow.
- Composite. A recognised group of foundations. Avatar group, button cluster, icon with a label. It knows the pattern. It does not know you sell wallets.
- Feature. Where domain knowledge lives. Wallet card, transaction item, balance header. It may hold local UI state, such as which row is expanded. It does not fetch its own data.
- Layout. Arranges children and holds no opinion about them. Side nav, top bar, a list, a section. Delete the children and there is nothing left to see.
The rule I check on every row: an inner layer never imports an outer one. A button that imports WalletCard has the dependency arrow backwards, and every future app that wants the button inherits the wallet.
Write the exits down
An audit that lives in a call recording changes nothing. Close it with three artefacts:
- The inventory, with a decision on every row.
- A short list of merges, each with the component that survives and the call sites to update.
- A folder structure that matches the four levels, so the next component has somewhere obvious to go.
Then fix the names so the level is visible without opening the file. WalletCardGroup sounds like a composite and is actually a feature. The naming rules are how you stop that happening again the week after the audit.
Do the mechanical merges first. They are boring, they delete code, and they make the level sort much clearer. I have never finished an audit and wished I had redrawn the buttons before I had deleted the duplicates.
Memorisely