daisyUI logo

daisyUI

The most popular component library for Tailwind CSS. Adds semantic component classes to cleaner HTML without the JS runtime overhead.

npm install daisyui
39.5K485.2K/weekv5.5.52.3 MBMIT19 issues
Last updated: 2025-11-15
Star history chart for saadeghi/daisyui

TL;DR

A Tailwind CSS plugin that provides component classes (like `btn`, `card`) instead of just utility classes, dramatically reducing class-name clutter.

Purely CSS-based: it gives you the look of a component library without locking you into a specific JavaScript framework's component API.

Why daisyUI?

Tailwind CSS is powerful, but it often leads to messy HTML cluttered with dozens of utility classes. daisyUI solves this by adding "component classes" to Tailwind.

Instead of writing class="py-2 px-4 bg-blue-500 text-white rounded-lg hover:bg-blue-700", you simply write class="btn btn-primary".

  • Clean JSX: Keeps your markup readable by abstracting common patterns into semantic class names.
  • Pure CSS Architecture: Unlike Material UI or Mantine, daisyUI has zero JavaScript. It creates the visual layer, and you control the logic (state, events) entirely.
  • Framework Agnostic: Because it's just CSS classes, your knowledge transfers 100% between React, Vue, Svelte, or plain HTML.
  • Semantic Theming: Comes with 29+ built-in themes (Cyberpunk, Dracula, Corporate) and a powerful theming engine that updates your entire app by changing a few CSS variables in the config.
  • Native HTML Elements: It styles standard HTML elements (<details>, <dialog>, <checkbox>) to work without complex React wrappers.

Code Snippet

This example shows how daisyUI simplifies a Card component. Note that we are using standard HTML/JSX tags with semantically named classes, not imported components.

export function ProductCard() {
  return (
    // 'card' provides the layout, 'bg-base-100' handles the theme color
    <div className="card w-96 bg-base-100 shadow-xl">
      <figure>
        <img src="/shoes.jpg" alt="Shoes" />
      </figure>
      
      <div className="card-body">
        <h2 className="card-title">
          Nike Air
          <div className="badge badge-secondary">NEW</div>
        </h2>
        <p>If a dog chews shoes whose shoes does he choose?</p>
        
        <div className="card-actions justify-end">
          <button className="btn btn-outline">Add to Cart</button>
          <button className="btn btn-primary">Buy Now</button>
        </div>
      </div>
    </div>
  )
}

Pros and Cons

Pros

  • Rapid Development: You get the speed of Bootstrap (pre-built components) with the customization of Tailwind.
  • Zero Bundle Size: Since it's just CSS that gets purged by Tailwind at build time, it adds no JavaScript weight to your application bundle.
  • Theming Engine: Changing the entire color scheme of your app (including dark mode) is often as simple as setting a data attribute data-theme="dark".

Cons

  • No Built-in Logic: Components like Modals, Dropdowns, and Carousels are visual only. You must write the React state (isOpen, onClick) or use the native <dialog> element yourself.
  • Design Opinion: While customizable, it has a distinct "look" out of the box. Overriding the default btn style requires writing CSS or modifying the Tailwind config.
  • Accessibility (A11y) Responsibility: Unlike Headless UI or Radix, daisyUI doesn't handle focus trapping or keyboard navigation for you. You are responsible for ensuring your interactive components are accessible.

Comparison with Other Libraries

LibraryDesign PhilosophyBest ForPain Points
daisyUICSS Components
Tailwind plugin adding semantic classes (btn).
Tailwind Users
Developers who want cleaner HTML but love Tailwind's workflow.
Missing Logic
You must build your own JS logic for interactive components (modals, tabs).
shadcn/uiHeadless + Tailwind
Copy-paste React components powered by Radix UI.
Complex Apps
Projects needing accessible, robust interactive components with full code ownership.
Setup Friction
Requires more initial configuration and boilerplate code than a simple CSS class.
Material UIReact Components
Fully encapsulated React components with their own styling engine.
Enterprise
Teams that want a "batteries-included" solution where everything just works.
Heavy Bundle
Significant runtime performance cost and harder to customize visually.

Verdict: When to Adopt

Choose daisyUI if you are building a project with Tailwind CSS and want to move fast without reinventing the wheel for every button and card. It is an excellent choice for MVPs, marketing sites, and admin panels where you are comfortable handling the minimal JavaScript logic required for interactivity. If you need rigorous accessibility guarantees for complex widgets (like Comboboxes), consider pairing it with a headless library or using shadcn/ui instead.