JS Guide
HomeQuestionsTopicsCompaniesResources
BookmarksSearch

Built for developers preparing for JavaScript, React & TypeScript interviews.

ResourcesQuestionsSupport
HomeQuestionsSearchProgress
HomeTopicsreactUI Component Libraries
PrevNext
react
intermediate
10 min read

UI Component Libraries

chakra
component-libraries
material-ui
radix
shadcn
theming
ui-libraries

UI component libraries fall into two categories — styled systems (MUI, Chakra) ship complete designs out of the box, while headless primitives (Radix, Headless UI) provide accessible behavior without opinions on styling, and shadcn/ui bridges the gap with copy-paste Radix+Tailwind components you own.

Key Points

1Styled vs Headless

Styled libraries (MUI, Chakra) ship complete designs. Headless libraries (Radix, React Aria) provide accessible behavior with zero styling — you bring your own CSS.

2MUI and Chakra

MUI implements Material Design with 50+ components and createTheme. Chakra uses style props (bg, p, borderRadius) with design tokens. Both use CSS-in-JS runtime.

3Radix and React Aria

Radix provides unstyled primitives with WAI-ARIA accessibility. React Aria provides hooks (useButton, useDialog) for maximum flexibility and i18n support.

4shadcn/ui Approach

Copy-paste Radix+Tailwind components into your project — you own and modify the source code. No npm dependency, no runtime CSS-in-JS, works with server components.

5Selection Criteria

Choose based on design requirements (custom vs opinionated), customization depth, bundle size, accessibility needs, and server component compatibility.

What You'll Learn

  • Compare styled component libraries (MUI, Chakra) with headless primitives (Radix, React Aria)
  • Explain the shadcn/ui approach and why copy-paste components have become popular
  • Know the tradeoffs between different UI library architectures for customization and bundle size
  • Decide when to use a UI library vs building components from scratch

Deep Dive

UI component libraries provide pre-built, accessible, and tested components so teams don't rebuild common widgets (buttons, modals, dropdowns, date pickers) from scratch. Choosing the right library depends on your design requirements, customization needs, and bundle size constraints.

Styled Component Libraries

These ship with complete visual designs — you get a polished UI immediately.

MUI (Material UI) is the most widely used React component library. It implements Google's Material Design specification with 50+ components, a comprehensive theming system (createTheme), and the sx prop for one-off style overrides. MUI uses Emotion for CSS-in-JS by default. Strengths: massive ecosystem, excellent documentation, enterprise adoption. Tradeoffs: Material Design is opinionated (apps tend to look "Googley"), large bundle size, customization beyond the design system can fight the framework.

Chakra UI takes a style-props approach where you style directly on components: <Box bg="blue.500" p={4} borderRadius="md">. It provides a design token system (colors, spacing, breakpoints) with excellent dark mode support built in. Strengths: intuitive API, great DX, responsive props (fontSize={{ base: 'sm', md: 'lg' }}). Tradeoffs: runtime CSS-in-JS overhead, less opinionated design means more design decisions fall on you.

Ant Design is popular for admin dashboards and enterprise applications, especially in teams with Chinese market exposure. It provides 60+ components including complex data-heavy widgets (Table with sorting/filtering/pagination, Tree, Transfer). Strengths: comprehensive data components, consistent enterprise look. Tradeoffs: distinctive visual style that's hard to customize away from.

Headless Component Libraries

These provide behavior, accessibility, and state management with zero styling — you bring your own CSS.

Radix UI provides unstyled primitives (Dialog, Dropdown, Accordion, Tooltip, etc.) with production-grade accessibility. Each component follows WAI-ARIA patterns with keyboard navigation, focus management, and screen reader support built in. You style with any CSS approach (Tailwind, CSS modules, styled-components). Strengths: accessibility-first, fully composable, small bundle per component. Tradeoffs: you must provide all styling yourself.

Headless UI (by the Tailwind team) provides a smaller set of common components (Menu, Dialog, Listbox, Combobox, Switch, Tabs) designed specifically for Tailwind CSS. Fewer components than Radix but excellent Tailwind integration.

React Aria (by Adobe) is the most thorough headless solution — it provides hooks (useButton, useDialog, useComboBox) rather than components, giving maximum flexibility. It handles internationalization, accessibility, and interaction patterns across devices. Strengths: most accessible, hook-based API gives full control. Tradeoffs: more verbose, steeper learning curve.

The shadcn/ui Approach

shadcn/ui is not a traditional npm package — it's a collection of copy-paste components built on Radix primitives and styled with Tailwind CSS. You run npx shadcn@latest add button and it copies the component source code into your project. You own the code and can modify it freely.

This approach has become extremely popular because it combines Radix's accessibility with Tailwind's utility classes, and you have full control over every line. The tradeoff is that you're responsible for maintaining and updating components yourself — there's no version bump that fixes bugs across all your components.

Choosing a Library

Key decision factors:

  • Design requirements: Custom design system → headless (Radix/React Aria). Material Design → MUI. Need to ship fast → styled library.
  • Customization depth: If you'll heavily customize, headless libraries won't fight you. Styled libraries have theming APIs but deep customization can require overriding internal styles.
  • Bundle size: Headless libraries are smaller per-component. Styled libraries include their CSS-in-JS runtime. shadcn/ui compiles to plain Tailwind with no runtime.
  • Accessibility requirements: Radix and React Aria provide the strongest a11y guarantees. MUI and Chakra have good accessibility but it varies by component.
  • Server components: CSS-in-JS libraries (Emotion, styled-components) don't work in React Server Components. Tailwind-based solutions (shadcn/ui) and CSS modules work everywhere.

Key Interview Distinction

Styled libraries (MUI, Chakra, Ant Design) give you complete designs immediately but can constrain customization. Headless libraries (Radix, React Aria, Headless UI) give you behavior and accessibility with full styling control. shadcn/ui bridges the gap with copy-paste Radix+Tailwind components you fully own. Choose based on design requirements, customization needs, and whether you need server component compatibility.

Fun Fact

shadcn/ui became the fastest-growing React UI project in 2023-2024 despite not being an installable package — you literally copy source files into your project. It popularized the idea that the best component library is one where you own every line of code. The creator (shadcn) later joined Vercel to work on Next.js.

Learn These First

Components

beginner

Props

beginner

Continue Learning

Accessibility (a11y)

intermediate

Advanced Patterns

advanced

Practice What You Learned

How do you integrate UI component libraries with React and when should you use them?
mid
libraries
UI libraries like Material-UI, Chakra UI, and Radix provide pre-built, accessible components. Integrate them by installing the package, wrapping your app with a ThemeProvider, and importing components. Use them for rapid development and consistent design; build custom when you need unique designs or minimal bundle size.
Previous
JSX
Next
Lists & Keys
PrevNext