Skip to main content

DaisyUI

DaisyUI is a component library built on Tailwind CSS, offering many pre-designed components.

Features

  • 🎨 pure CSS components:no JavaScript dependency
  • 🎭 30+ themes: multiple built-in themes with dark mode support
  • 🧩 semantic class names:easy to understand and use
  • 🎯 Tailwind-compatible: integrates cleanly with Tailwind CSS
  • 📦 lightweight:load on demand,small size

Installation

Configuration tailwind.config.js

Common Components

Button

Card

Form

Alert

Badge

Theme Switching

Using an HTML attribute

Switching with JavaScript

Theme SwitchingComponent

Custom Theme

Useful utility classes

Layout Components

Drawer

Best Practices

  1. Combine with Tailwind: DaisyUI components work well with Tailwind utility classes.
  2. Keep themes consistent across the whole project.
  3. Use Tailwind responsive prefixes for responsive design.
  4. Avoid unnecessary customization and start with presets.
  5. Load on demand by configuring PurgeCSS to remove unused styles.

References

Last modified on April 17, 2026