Language: JavaScript
UI Framework
DaisyUI was created to complement Tailwind CSS by providing pre-built, customizable components that follow Tailwind’s utility-first approach. It emphasizes rapid development while maintaining accessibility and flexibility for developers.
DaisyUI is a plugin for Tailwind CSS that provides a set of accessible, responsive, and themeable UI components. It extends Tailwind with ready-made components like buttons, forms, cards, modals, and more.
npm install daisyuiyarn add daisyuiAdd DaisyUI as a plugin in your Tailwind CSS configuration.DaisyUI components are styled using Tailwind classes and can be customized via themes. Components include buttons, inputs, modals, alerts, navigation bars, and more. You can also define custom themes or use built-in themes.
<button class='btn btn-primary'>Click Me</button>Creates a primary-styled button using DaisyUI classes.
<input type='text' placeholder='Enter text' class='input input-bordered' />Creates a styled input field with borders and placeholder text.
<div class='card w-96 bg-base-100 shadow-xl'>
<div class='card-body'>
<h2 class='card-title'>Card Title</h2>
<p>Card content goes here.</p>
<div class='card-actions justify-end'>
<button class='btn btn-primary'>Action</button>
</div>
</div>
</div>Displays a card component with title, content, and an action button.
<input type='checkbox' id='my-modal' class='modal-toggle' />
<div class='modal'>
<div class='modal-box'>
<h3 class='font-bold text-lg'>Modal Title</h3>
<p>Modal content here.</p>
<div class='modal-action'>
<label for='my-modal' class='btn'>Close</label>
</div>
</div>
</div>Implements a modal dialog using DaisyUI’s modal classes and a hidden checkbox to toggle visibility.
<div class='alert alert-success'>
<div>
<span>Success! Operation completed.</span>
</div>
</div>Displays a success alert message with DaisyUI styling.
Use DaisyUI in combination with Tailwind’s utility classes for consistent styling.
Leverage DaisyUI themes to maintain a consistent color palette.
Import only the components you need to keep bundle size minimal.
Use responsive and state classes to adapt components to different screen sizes.
Customize component classes to extend functionality while retaining default styling.