shadcn/ui Base UI vs Radix: which primitive library to pick
Compare Radix UI (asChild, data-state) and Base UI (render prop, data-open) in shadcn/ui: composition, Tailwind v4 animations, registries, and when to pick each.
- shadcn 4.23.0
- Tailwind CSS 4.3.5
- Vite 8
- React 19.3
Since 2026, shadcn init lets you choose between Radix UI and Base UI for interactive primitives (dialogs, menus, selects, popovers, accordions). Both generate components with the same Tailwind CSS v4 styling and copy the files into your repo. Pick Radix if you want the widest third-party block and tutorial compatibility today; pick Base UI if you are starting a new React 19 app and want render props instead of asChild.
Side-by-side comparison
| Aspect | Radix UI | Base UI |
|---|---|---|
| Composition API | asChild prop (Slot merging) | render prop (render={<a href="..." />}) |
| Open/closed attribute | data-state="open" / "closed" | data-open / data-closed (boolean attributes) |
| Package layout | Unified radix-ui package (or per-primitive @radix-ui/react-*) | Single @base-ui/react package |
| Combobox & Autocomplete | Built on cmdk + Popover | First-class primitive |
| Third-party registries | Supported by almost every existing registry | Growing; check before copying blocks |
| Maintainer | WorkOS | MUI (former Radix & Floating UI authors) |
The main code difference: asChild vs render
When you want a trigger or button to render as a Next.js <Link> or an <a> tag, Radix uses asChild and merges props onto the single child element:
<DialogTrigger asChild> <Button variant="outline">Open settings</Button></DialogTrigger>Base UI replaces asChild with a render prop. It avoids React's cloneElement quirks and makes TypeScript types stricter:
<DialogTrigger render={<Button variant="outline" />}> Open settings</DialogTrigger>Why Tailwind v4 animations work with both
Radix sets data-state="open", whereas Base UI sets a bare data-open attribute. Both work with the same shadcn/ui classes because @import "shadcn/tailwind.css"; maps data-open: to both selectors. If animations stop working after switching, check shadcn/ui animations not working on Tailwind v4.
Which one should you choose?
- Pick Radix UI if you install blocks from community registries, follow existing shadcn/ui tutorials, or maintain an app that already uses
asChild. Every themes.dev block and component runs on Radix out of the box. - Pick Base UI if you are starting greenfield on React 19, rely heavily on comboboxes/number fields/portals, and prefer explicit
renderprops overasChild.
Questions
Can I switch an existing project from Radix to Base UI?
Not automatically. Because every asChild usage becomes a render prop and some subcomponent names differ, switching means re-installing your components/ui/ files and updating call sites. Use npx shadcn@latest add --dry-run first; see how to update shadcn/ui components.
Is one faster or smaller than the other?
In practice the difference is a few kilobytes gzipped once tree-shaken. Pick based on API ergonomics and ecosystem compatibility, not micro-benchmarks. For the full architecture overview, read shadcn/ui explained.
Related articles
- shadcn/uishadcn/ui animations not working on Tailwind v4Dialogs and accordions without animation mean a missing tw-animate-css or shadcn/tailwind.css import. Why the second one fails silently, and how to check.
- shadcn/uiHow to update shadcn/ui components without losing your changesThere is no update command: use add --dry-run and --diff to see changes, --overwrite to take them, and Git to put your own edits back.
- shadcn/uishadcn blocks vs components: what is the difference?A component is one interface part, a block is a finished section built from several. How primitives, components, blocks and page templates fit together.
Still stuck? We answer every message ourselves. Write to us