Component Libraries: shadcn/ui and Radix
Build on accessible headless primitives (Radix, React Aria) and copy-in components (shadcn/ui) instead of reinventing dropdowns and dialogs.
Intermediate · about 4 hours · difficulty 3/5
Learn first: Design Tokens and Theming, ARIA and Accessible Custom Widgets, Context and Component Composition
Dialogs, dropdown menus, comboboxes, tooltips and date pickers are deceptively hard: focus management, keyboard support, ARIA, positioning and edge cases take weeks to get right. Mature teams build on libraries that already solve them.
Headless primitives
Radix UI, React Aria (Adobe), Base UI and Ark UI provide unstyled, accessible behaviour. You bring the styles. For example Radix's Dialog.Root, Dialog.Trigger and Dialog.Content handle focus trapping, Escape to close, scroll locking and ARIA for you.
shadcn/ui
Not a package you install as a dependency, but a collection of well-designed components built on Radix-style primitives and Tailwind that a CLI copies into your codebase. You own and edit the code, theme it with CSS variables and extend variants (often with class-variance-authority). It has become a very common starting point for React apps.
Full component suites
MUI, Mantine, Chakra UI and Ant Design provide complete styled component sets with theming. They are fast for internal tools and admin panels, at the cost of a stronger visual identity and bigger bundles.
Building your own components well
- Wrap primitives in your own components with a small, consistent API (
variant,size,asChild). - Forward refs and spread remaining props so components compose.
- Keep accessibility: labels, focus styles and keyboard behaviour must survive your styling.
- Document usage and do's and don'ts.
Good enough to move on
You can set up shadcn/ui in a project, customise its theme and a component's variants, and build a new accessible component from a Radix primitive.
Key concepts
- Headless vs styled component libraries
- Radix UI primitives
- shadcn/ui
- React Aria and Base UI
- MUI, Mantine and Chakra
- Variants with class-variance-authority
- Component API design
Mini project
Build a settings page from shadcn/ui components themed with your own tokens, then create a new accessible Combobox or Command menu component from primitives with keyboard navigation.
Check yourself
What does a headless library like Radix give you, and what is still your responsibility?
Free resources
- shadcn/ui (shadcn/ui)
- Radix Primitives (Radix)
- React Aria (Adobe)