What Is a Component Library and How Do You Choose One for React?
A component library is a collection of prebuilt UI pieces — buttons, cards, navigation, hero sections — that you drop into an app instead of writing from scratch. For React projects, the practical choice is usually between a package you install (Base UI, visx) and source you copy into your repo (shadcn/ui, Aceternity UI, Magic UI). Pick the copy-in model when you want full control over styling and no dependency lock-in; pick the package model when you want versioned updates and don't plan to fork the internals. Aggregators like 21st let you search across many of these libraries at once and pull a single component in as a prompt or source file.
Component library vs. UI framework vs. design system
These three get used interchangeably, but they solve different problems:
| Term | What it gives you | Example |
|---|---|---|
| Component library | Individual UI pieces you assemble yourself | shadcn/ui, Aceternity UI, Magic UI |
| UI framework | A full set of components plus layout, theming, and behavior conventions | (heavier, opinionated stacks) |
| Design system | Rules, tokens, and governance for how UI should look and behave across teams | Internal to a company |
A component library is the smallest unit. It doesn't dictate your app structure — it hands you a button and lets you decide where it goes. That's why most React teams now mix several libraries rather than adopting one framework.
The main React/Tailwind options
21st's own index lists the libraries it aggregates, with component counts, which is a useful snapshot of the ecosystem's shape:
- shadcn/ui — 87 components. The de facto convention: source copied into your repo, built on Tailwind and Radix primitives.
- Aceternity UI — 87 components. Known for animated, marketing-oriented pieces.
- Magic UI — 62 components. Similar animated/marketing focus.
- Origin UI — 44 components.
- Geist — 87 components (Vercel's design language).
- Base UI — 29 components. Unstyled primitives, closer to a package model.
- Kokonut UI — 49 components.
- 8bitcn — 106 components.
- Kibo UI — 26 components.
- visx — 36 components. Data-visualization primitives from Airbnb.
- ReUI — 95 components.
- HextaUI — 113 components.
21st itself is not a single library — it's an aggregator. Its page describes "12,000+ crafted React components, templates, and shadcn themes," split into roughly 2,000+ marketing blocks (animated heroes, shaders, gradients, footers) and 2,100+ UI components (buttons, AI chats, cards, navigation, sign-ins). Each component carries an author credit, and the site reports being used by 3,819,076 builders.
Copy-paste source vs. npm package
This is the decision that matters most, because it determines your maintenance burden.
Copy-in source (shadcn/ui model):
- You own the code. Edit anything, no override hacks.
- No version drift from an upstream package — but also no automatic fixes.
- Bundle only includes what you actually copied.
- Works well with AI agents, because the agent edits a file in your repo rather than fighting a dependency.
npm package (Base UI, visx model):
- Upgrades arrive via your package manager.
- You customize through props, slots, and theme overrides.
- Bundle impact depends on tree-shaking; check that your bundler handles it.
- Breaking changes land on the maintainer's schedule, not yours.
21st leans hard into the copy-in model and extends it: every component "ships as a prompt." You copy the prompt and paste it into Claude Code, Codex, or Lovable, and the tool writes the component into your project. The page shows the same prompt producing a terminal install in Claude Code, a diff-based PR in Codex, and an inline preview in Lovable. The output is React + Tailwind following shadcn/ui conventions — real source in your repo, not a black box.
How to evaluate a library before committing
Run these checks in order; the first one that fails usually ends the evaluation.
- Styling fit. Does it use Tailwind and match your token setup? If it ships its own CSS-in-JS or a separate theme system, budget time for reconciliation.
- Install effort. Copy one component into a scratch project and see what breaks. A component that needs three peer dependencies and a config change is a different commitment than a single file.
- Bundle impact. Build the scratch project and inspect the output. Animated components often pull in motion libraries; confirm the cost is acceptable.
- Licensing. Check the license on the library and on any component you pull from an aggregator. Aggregated components have individual authors, so terms can vary.
- Accessibility. Tab through the component with a keyboard and run it past a screen reader. Copy-in libraries vary widely here — some wrap accessible primitives, some don't.
- Maintenance signal. Look at recent activity and whether the component you want is a one-off or part of a maintained set.
Where AI-agent compatibility fits
If you use an AI coding agent, "can the agent install this?" becomes a real selection criterion. A component that ships as a prompt or a single source file is trivial for an agent to place and adapt. A component buried in a package with runtime theming is harder — the agent has to know the API, and mistakes surface as type errors rather than visible diffs.
21st's model is built around this: the prompt is the distribution format, and the agent adapts the component to your theme as it writes the file. The page notes 25,431 installs in a week, which suggests the workflow is being used at volume.
Common pitfalls
- Mixing too many libraries. Pulling buttons from one, cards from another, and navigation from a third produces inconsistent spacing, radii, and motion. Pick a primary library and treat others as exceptions.
- Version drift. With copy-in source, you won't get upstream fixes automatically. If a library patches an accessibility bug, you won't know unless you check.
- Accessibility gaps. Animated and marketing-oriented libraries sometimes skip focus management and ARIA. Test before shipping to production.
- Aggregator licensing surprises. When you pull a component from an aggregator, confirm the terms for that specific component, not just the aggregator's site.
- Assuming free. 21st has a pricing page, so check current terms before building a workflow around it.
A practical starting point
For most React + Tailwind projects: start with shadcn/ui as your base convention, add a marketing-oriented library (Aceternity or Magic UI) for landing-page sections, and use an aggregator like 21st when you need something specific and don't want to browse five sites. Keep the copy-in model for anything you'll customize heavily, and reserve npm packages for primitives you won't touch.