DaisyUI Component Library Summary
DaisyUI is the most popular Tailwind CSS component library providing semantic class names for 50+ components with built-in themes, dark mode, and customization. Framework-agnostic and production-ready.
When to Use Building UI with Tailwind CSS and need pre-styled components Want semantic class names (btn, card) instead of utility-only approach Need built-in theming system with 30+ themes and dark mode Require consistent design system across React, Vue, Svelte, or vanilla HTML Want to prototype quickly with ready-made components Need accessible components following semantic HTML patterns Quick Start Installation npm install -D daisyui@latest
Configuration
Add to tailwind.config.js:
module.exports = { plugins: [require("daisyui")], daisyui: { themes: ["light", "dark", "cupcake"], // Enable specific themes darkTheme: "dark", // Default dark theme base: true, // Base styles styled: true, // Component styles utils: true, // Utility classes }, }
Basic Usage
Card Title
Card description goes here
Core Components Buttons
Cards

Card Title
Description text
Compact Card
Reduced padding
Title
NEW
Content

Overlay Text
Text appears on top of image
Modals
Forms
Navigation
Layout Components
Hello there
Provident cupiditate voluptatem et in.
Data Display
| Name | Job | Company |
|---|---|---|
| Cy Ganderton | Quality Control Specialist | Littel, Schaden and Vandervort |
| Hart Hagerty | Desktop Support Technician | Zemlak, Daniel and Leannon |
-
1984First Macintosh computer
-
1998iMac
Feedback Components
Theming System Built-in Themes
DaisyUI includes 30+ pre-built themes:
// tailwind.config.js module.exports = { daisyui: { themes: [ "light", // Default light theme "dark", // Default dark theme "cupcake", // Pink/pastel theme "bumblebee", // Yellow theme "emerald", // Green theme "corporate", // Professional blue "synthwave", // Retro neon "retro", // Vintage brown "cyberpunk", // Neon yellow/pink "valentine", // Pink/red romantic "halloween", // Orange/purple spooky "garden", // Green nature "forest", // Dark green "aqua", // Blue ocean "lofi", // Low contrast "pastel", // Soft colors "fantasy", // Purple/pink fantasy "wireframe", // Minimal black/white "black", // Dark minimal "luxury", // Gold/black elegant "dracula", // Purple dark theme "cmyk", // Print colors "autumn", // Orange/brown "business", // Professional dark "acid", // Neon green "lemonade", // Yellow/green fresh "night", // Deep blue dark "coffee", // Brown coffee shop "winter", // Blue/white cold "dim", // Low light dark "nord", // Nordic blue/gray "sunset", // Orange/purple gradient ], }, }
Theme Switching
Dark Mode // Auto dark mode based on system preference module.exports = { daisyui: { themes: ["light", "dark"], darkTheme: "dark", }, }
Custom Theme // tailwind.config.js module.exports = { daisyui: { themes: [ { mytheme: { "primary": "#a991f7", "secondary": "#f6d860", "accent": "#37cdbe", "neutral": "#3d4451", "base-100": "#ffffff", "info": "#3abff8", "success": "#36d399", "warning": "#fbbd23", "error": "#f87272", }, }, ], }, }
Extending Existing Themes module.exports = { daisyui: { themes: [ { light: { ...require("daisyui/src/theming/themes")["light"], primary: "#0000ff", // Override primary color ".btn-twitter": { // Custom component "background-color": "#1da1f2", "border-color": "#1da1f2", }, }, }, ], }, }
CSS Variable Customization / Override theme variables / [data-theme="mytheme"] { --rounded-box: 1rem; --rounded-btn: 0.5rem; --rounded-badge: 1.9rem; --animation-btn: 0.25s; --animation-input: 0.2s; --btn-text-case: uppercase; --btn-focus-scale: 0.95; --border-btn: 1px; --tab-border: 1px; --tab-radius: 0.5rem; }
Color System Semantic Colors
DaisyUI uses semantic color names that adapt to themes:
Primary text
Text on primary background
Secondary text
Text on secondary background
Accent text
Text on accent background
Neutral text
Text on neutral background
Base text color
Color Utilities
Framework Integration React import React from 'react';
// DaisyUI works with plain HTML classes function App() { return (
Card Title
Card description
// Modal component function Modal({ children, id }) { return ( ); }
// Usage
function App() {
return (
<>
Modal contentHello!
Vue
Card description
Card Title
Svelte
Card Title
Card description
Responsive Design Responsive Utilities
Mobile-First Approach
Advanced Configuration Complete Configuration // tailwind.config.js module.exports = { content: ["./src/*/.{html,js,jsx,ts,tsx}"], plugins: [require("daisyui")], daisyui: { themes: [ "light", "dark", { mytheme: { primary: "#570df8", secondary: "#f000b8", accent: "#37cdbe", neutral: "#3d4451", "base-100": "#ffffff", info: "#3abff8", success: "#36d399", warning: "#fbbd23", error: "#f87272", }, }, ], darkTheme: "dark", base: true, styled: true, utils: true, prefix: "", logs: true, themeRoot: ":root", }, }
Configuration Options themes: Array of theme names or custom theme objects darkTheme: Which theme to use for dark mode (default: "dark") base: Apply base styles (default: true) styled: Apply component styles (default: true) utils: Apply utility classes (default: true) prefix: Prefix for all daisyUI classes (default: "") logs: Show info in terminal during build (default: true) themeRoot: Root element for theme (default: ":root") Disable Base Styles // Only use components, not base styles module.exports = { daisyui: { base: false, // Don't apply base HTML styles styled: true, utils: true, }, }
Class Prefix // Add prefix to avoid conflicts module.exports = { daisyui: { prefix: "daisy-", }, }
Best Practices Component Organization // Create reusable component library // components/Button.jsx export function Button({ variant = 'primary', size = 'md', children, ...props }) { return ( ); }
// Usage
Theme Management // utils/theme.js export const THEMES = [ 'light', 'dark', 'cupcake', 'bumblebee', 'emerald', 'corporate' ];
export function getTheme() { return localStorage.getItem('theme') || 'light'; }
export function setTheme(theme) { document.documentElement.setAttribute('data-theme', theme); localStorage.setItem('theme', theme); }
export function toggleDarkMode() { const current = getTheme(); const next = current === 'light' ? 'dark' : 'light'; setTheme(next); }
Accessibility
Performance Optimization // Only import themes you use module.exports = { daisyui: { themes: ["light", "dark"], // Only these 2 themes }, }
// Or use custom themes only module.exports = { daisyui: { themes: [ { light: { / custom light / }, dark: { / custom dark / }, }, ], }, }
Combining with Tailwind
Common Patterns Loading States function DataComponent() { const [loading, setLoading] = useState(true);
if (loading) { return (
return
Form Validation function LoginForm() { const [errors, setErrors] = useState({});
return (