daisyUI 5 is a CSS library for Tailwind CSS 4 daisyUI 5 provides class names for common UI components
- daisyUI 5 docs
- Guide: How to use this file in LLMs and code editors
- daisyUI 5 release notes
- daisyUI 4 to 5 upgrade guide
- daisyUI 5 requires Tailwind CSS 4
tailwind.config.jsfile is deprecated in Tailwind CSS v4. do not usetailwind.config.js. Tailwind CSS v4 only needs@import "tailwindcss";in the CSS file if it's a node dependency.- daisyUI 5 can be installed using
npm i -D daisyui@latestand then adding@plugin "daisyui";to the CSS file - daisyUI is suggested to be installed as a dependency but if you really want to use it from CDN, you can use Tailwind CSS and daisyUI CDN files:
<link href="https://cdn.jsdelivr.net/npm/daisyui@5" rel="stylesheet" type="text/css" />
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>- A CSS file with Tailwind CSS and daisyUI looks like this (if it's a node dependency)
@import "tailwindcss";
@plugin "daisyui";- We can give styles to a HTML element by adding daisyUI class names to it. By adding a component class name, part class names (if there's any available for that component), and modifier class names (if there's any available for that component)
- Components can be customized using Tailwind CSS utility classes if the customization is not possible using the existing daisyUI classes. For example
btn px-10sets a custom horizontal padding to abtn - If customization of daisyUI styles using Tailwind CSS utility classes didn't work because of CSS specificity issues, you can use the
!at the end of the Tailwind CSS utility class to override the existing styles. For examplebtn bg-red-500!sets a custom background color to abtnforcefully. This is a last resort solution and should be used sparingly - If a specific component or something similar to it doesn't exist in daisyUI, you can create your own component using Tailwind CSS utility
- when using Tailwind CSS
flexandgridfor layout, it should be responsive using Tailwind CSS responsive utility prefixes. - Only allowed class names are existing daisyUI class names or Tailwind CSS utility classes.
- Ideally, you won't need to write any custom CSS. Using daisyUI class names or Tailwind CSS utility classes is preferred.
- suggested - if you need placeholder images, use https://picsum.photos/200/300 with the size you want
- suggested - when designing , don't add a custom font unless it's necessary
- don't add
bg-base-100 text-base-contentto body unless it's necessary - For design decisions, use Refactoring UI book best practices
daisyUI 5 class names are one of the following categories. these type names are only for reference and are not used in the actual code
component: the required component classpart: a child part of a componentstyle: sets a specific style to component or partbehavior: changes the behavior of component or partcolor: sets a specific color to component or partsize: sets a specific size to component or partplacement: sets a specific placement to component or partdirection: sets a specific direction to component or partmodifier: modifies the component or part in a specific way
daisyUI 5 config docs: https://daisyui.com/docs/config/ daisyUI without config:
@plugin "daisyui";daisyUI config with light theme only:
@plugin "daisyui" {
themes: light --default;
}daisyUI with all the default configs:
@plugin "daisyui" {
themes: light --default, dark --prefersdark;
root: ":root";
include: ;
exclude: ;
prefix: ;
logs: true;
}An example config:
In below config, all the built-in themes are enabled while bumblebee is the default theme and synthwave is the prefersdark theme (default dark mode)
All the other themes are enabled and can be used by adding data-theme="THEME_NAME" to the <html> element
root scrollbar gutter is excluded. daisy- prefix is used for all daisyUI classes and console.log is disabled
@plugin "daisyui" {
themes: light, dark, cupcake, bumblebee --default, emerald, corporate, synthwave --prefersdark, retro, cyberpunk, valentine, halloween, garden, forest, aqua, lofi, pastel, fantasy, wireframe, black, luxury, dracula, cmyk, autumn, business, acid, lemonade, night, coffee, winter, dim, nord, sunset, caramellatte, abyss, silk;
root: ":root";
include: ;
exclude: rootscrollgutter, checkbox;
prefix: daisy-;
logs: false;
}primary: Primary brand color, The main color of your brandprimary-content: Foreground content color to use on primary colorsecondary: Secondary brand color, The optional, secondary color of your brandsecondary-content: Foreground content color to use on secondary coloraccent: Accent brand color, The optional, accent color of your brandaccent-content: Foreground content color to use on accent colorneutral: Neutral dark color, For not-saturated parts of UIneutral-content: Foreground content color to use on neutral colorbase-100:-100 Base surface color of page, used for blank backgroundsbase-200:-200 Base color, darker shade, to create elevationsbase-300:-300 Base color, even more darker shade, to create elevationsbase-content: Foreground content color to use on base colorinfo: Info color, For informative/helpful messagesinfo-content: Foreground content color to use on info colorsuccess: Success color, For success/safe messagessuccess-content: Foreground content color to use on success colorwarning: Warning color, For warning/caution messageswarning-content: Foreground content color to use on warning colorerror: Error color, For error/danger/destructive messageserror-content: Foreground content color to use on error color
- daisyUI adds semantic color names to Tailwind CSS colors
- daisyUI color names can be used in utility classes, like other Tailwind CSS color names. for example,
bg-primarywill use the primary color for the background - daisyUI color names include variables as value so they can change based the theme
- There's no need to use
dark:for daisyUI color names - Ideally only daisyUI color names should be used for colors so the colors can change automatically based on the theme
- If a Tailwind CSS color name (like
red-500) is used, it will be same red color on all themes - If a daisyUI color name (like
primary) is used, it will change color based on the theme - Using Tailwind CSS color names for text colors should be avoided because Tailwind CSS color
text-gray-800onbg-base-100would be unreadable on a dark theme - because on dark theme,bg-base-100is a dark color *-contentcolors should have a good contrast compared to their associated colors- suggestion - when designing a page use
base-*colors for majority of the page. useprimarycolor for important elements
A CSS file with Tailwind CSS, daisyUI and a custom daisyUI theme looks like this:
@import "tailwindcss";
@plugin "daisyui";
@plugin "daisyui/theme" {
name: "mytheme";
default: true; /* set as default */
prefersdark: false; /* set as default dark mode (prefers-color-scheme:dark) */
color-scheme: light; /* color of browser-provided UI */
--color-base-100: oklch(98% 0.02 240);
--color-base-200: oklch(95% 0.03 240);
--color-base-300: oklch(92% 0.04 240);
--color-base-content: oklch(20% 0.05 240);
--color-primary: oklch(55% 0.3 240);
--color-primary-content: oklch(98% 0.01 240);
--color-secondary: oklch(70% 0.25 200);
--color-secondary-content: oklch(98% 0.01 200);
--color-accent: oklch(65% 0.25 160);
--color-accent-content: oklch(98% 0.01 160);
--color-neutral: oklch(50% 0.05 240);
--color-neutral-content: oklch(98% 0.01 240);
--color-info: oklch(70% 0.2 220);
--color-info-content: oklch(98% 0.01 220);
--color-success: oklch(65% 0.25 140);
--color-success-content: oklch(98% 0.01 140);
--color-warning: oklch(80% 0.25 80);
--color-warning-content: oklch(20% 0.05 80);
--color-error: oklch(65% 0.3 30);
--color-error-content: oklch(98% 0.01 30);
--radius-selector: 1rem; /* border radius of selectors (checkbox, toggle, badge) */
--radius-field: 0.25rem; /* border radius of fields (button, input, select, tab) */
--radius-box: 0.5rem; /* border radius of boxes (card, modal, alert) */
/* preferred values for --radius-* : 0rem, 0.25rem, 0.5rem, 1rem, 2rem */
--size-selector: 0.25rem; /* base size of selectors (checkbox, toggle, badge). Value must be 0.25rem unless we intentionally want bigger selectors. In so it can be 0.28125 or 0.3125. If we intentionally want smaller selectors, it can be 0.21875 or 0.1875 */
--size-field: 0.25rem; /* base size of fields (button, input, select, tab). Value must be 0.25rem unless we intentionally want bigger fields. In so it can be 0.28125 or 0.3125. If we intentionally want smaller fields, it can be 0.21875 or 0.1875 */
--border: 1px; /* border size. Value must be 1px unless we intentionally want thicker borders. In so it can be 1.5px or 2px. If we intentionally want thinner borders, it can be 0.5px */
--depth: 1; /* only 0 or 1 – Adds a shadow and subtle 3D depth effect to components */
--noise: 0; /* only 0 or 1 - Adds a subtle noise (grain) effect to components */
}- All CSS variables above are required
- Colors can be OKLCH or hex or other formats
- If you're generating a custom theme, do not include the comments from the example above. Just provide the code.
People can use https://daisyui.com/theme-generator/ visual tool to create their own theme.
Accordion is used for showing and hiding content but only one item can stay open at a time
- component:
collapse - part:
collapse-title,collapse-content - modifier:
collapse-arrow,collapse-plus,collapse-open,collapse-close
<div class="collapse {MODIFIER}">{CONTENT}</div>where content is:
<input type="radio" name="{name}" checked="{checked}" />
<div class="collapse-title">{title}</div>
<div class="collapse-content">{CONTENT}</div>- {MODIFIER} is optional and can have one of the modifier class names
- Accordion uses radio inputs. All radio inputs with the same name work together and only one of them can be open at a time
- If you have more than one set of accordion items on a page, use different names for the radio inputs on each set
- Replace {name} with a unique name for the accordion group
- replace
{checked}withchecked="checked"if you want the accordion to be open by default
Alert informs users about important events
- component:
alert - style:
alert-outline,alert-dash,alert-soft - color:
alert-info,alert-success,alert-warning,alert-error - direction:
alert-vertical,alert-horizontal
<div role="alert" class="alert {MODIFIER}">{CONTENT}</div>- {MODIFIER} is optional and can have one of each style/color/direction class names
- Add
sm:alert-horizontalfor responsive layouts
Avatars are used to show a thumbnail
- component:
avatar,avatar-group - modifier:
avatar-online,avatar-offline,avatar-placeholder
<div class="avatar {MODIFIER}">
<div>
<img src="{image-url}" />
</div>
</div>- {MODIFIER} is optional and can have one of the modifier class names
- Use
avatar-groupfor containing multiple avatars - You can set custom sizes using
w-*andh-* - You can use mask classes such as
mask-squircle,mask-hexagon,mask-triangle
Badges are used to inform the user of the status of specific data
- component:
badge - style:
badge-outline,badge-dash,badge-soft,badge-ghost - color:
badge-neutral,badge-primary,badge-secondary,badge-accent,badge-info,badge-success,badge-warning,badge-error - size:
badge-xs,badge-sm,badge-md,badge-lg,badge-xl
<span class="badge {MODIFIER}">Badge</span>- {MODIFIER} is optional and can have one of each style/color/size class names
- Can be used inside text or buttons
- To create an empty badge, just remove the text between the span tags
Breadcrumbs helps users to navigate
- component:
breadcrumbs
<div class="breadcrumbs">
<ul><li><a>Link</a></li></ul>
</div>- breadcrumbs only has one main class name
- Can contain icons inside the links
- If you set
max-widthor the list gets larger than the container it will scroll
Buttons allow the user to take actions
- component:
btn - color:
btn-neutral,btn-primary,btn-secondary,btn-accent,btn-info,btn-success,btn-warning,btn-error - style:
btn-outline,btn-dash,btn-soft,btn-ghost,btn-link - behavior:
btn-active,btn-disabled - size:
btn-xs,btn-sm,btn-md,btn-lg,btn-xl - modifier:
btn-wide,btn-block,btn-square,btn-circle
<button class="btn {MODIFIER}">Button</button>- {MODIFIER} is optional and can have one of each color/style/behavior/size/modifier class names
- btn can be used on any html tags such as
<button>,<a>,<input> - btn can have an icon before or after the text
- set
tabindex="-1" role="button" aria-disabled="true"if you want to disable the button using a class name
Calendar includes styles for different calendar libraries
- component
cally (for Cally web component)pika-single (for the input field that opens Pikaday calendar)react-day-picker (for the DayPicker component)
For Cally:
<calendar-date class="cally">{CONTENT}</calendar-date>For Pikaday:
<input type="text" class="input pika-single">For React Day Picker:
<DayPicker className="react-day-picker">- daisyUI supports Cally, Pikaday, React Day Picker
Cards are used to group and display content
- component:
card - part:
card-title,card-body,card-actions - style:
card-border,card-dash - modifier:
card-side,image-full - size:
card-xs,card-sm,card-md,card-lg,card-xl
<div class="card {MODIFIER}">
<figure><img src="{image-url}" alt="{alt-text}" /></figure>
<div class="card-body">
<h2 class="card-title">{title}</h2>
<p>{CONTENT}</p>
<div class="card-actions">{actions}</div>
</div>
</div>- {MODIFIER} is optional and can have one of the modifier class names and one of the size class names
<figure>and<div class="card-body">are optional- can use
sm:card-horizontalfor responsive layouts - If image is placed after
card-body, the image will be placed at the bottom
Carousel show images or content in a scrollable area
- component:
carousel - part:
carousel-item - modifier:
carousel-start,carousel-center,carousel-end - direction:
carousel-horizontal,carousel-vertical
<div class="carousel {MODIFIER}">{CONTENT}</div>- {MODIFIER} is optional and can have one of the modifier/direction class names
- Content is a list of
carousel-itemdivs:<div class="carousel-item"></div> - To create a full-width carousel, add
w-fullto each carousel item
Chat bubbles are used to show one line of conversation and all its data, including the author image, author name, time, etc
- component:
chat - part:
chat-image,chat-header,chat-footer,chat-bubble - placement:
chat-start,chat-end - color:
chat-bubble-neutral,chat-bubble-primary,chat-bubble-secondary,chat-bubble-accent,chat-bubble-info,chat-bubble-success,chat-bubble-warning,chat-bubble-error
<div class="chat {PLACEMENT}">
<div class="chat-image"></div>
<div class="chat-header"></div>
<div class="chat-bubble {COLOR}">Message text</div>
<div class="chat-footer"></div>
</div>- {PLACEMENT} is required and must be either
chat-startorchat-end - {COLOR} is optional and can have one of the color class names
- To add an avatar, use
<div class="chat-image avatar">and nest the avatar content inside
Checkboxes are used to select or deselect a value
- component:
checkbox - color:
checkbox-primary,checkbox-secondary,checkbox-accent,checkbox-neutral,checkbox-success,checkbox-warning,checkbox-info,checkbox-error - size:
checkbox-xs,checkbox-sm,checkbox-md,checkbox-lg,checkbox-xl
<input type="checkbox" class="checkbox {MODIFIER}" />- {MODIFIER} is optional and can have one of each color/size class names
Collapse is used for showing and hiding content
- component:
collapse - part:
collapse-title,collapse-content - modifier:
collapse-arrow,collapse-plus,collapse-open,collapse-close
<div tabindex="0" class="collapse {MODIFIER}">
<div class="collapse-title">{title}</div>
<div class="collapse-content">{CONTENT}</div>
</div>- {MODIFIER} is optional and can have one of the modifier class names
- instead of
tabindex="0", you can use<input type="checkbox">as a first child - Can also be a details/summary tag
Countdown gives you a transition effect when you change a number between 0 to 99
- component:
countdown
<span class="countdown">
<span style="--value:{number};">number</span>
</span>- The
--valueCSS variable and text must be a number between 0 and 99 - you need to change the span text and the
--valueCSS variable using JS - you need to add
aria-live="polite"andaria-label="{number}"so screen readers can properly read changes
Diff component shows a side-by-side comparison of two items
- component:
diff - part:
diff-item-1,diff-item-2,diff-resizer
<figure class="diff">
<div class="diff-item-1">{item1}</div>
<div class="diff-item-2">{item2}</div>
<div class="diff-resizer"></div>
</figure>- To maintain aspect ratio, add
aspect-16/9or other aspect ratio classes to<figure class="diff">element
Divider will be used to separate content vertically or horizontally
- component:
divider - color:
divider-neutral,divider-primary,divider-secondary,divider-accent,divider-success,divider-warning,divider-info,divider-error - direction:
divider-vertical,divider-horizontal - placement:
divider-start,divider-end
<div class="divider {MODIFIER}">{text}</div>- {MODIFIER} is optional and can have one of each direction/color/placement class names
- Omit text for a blank divider
Dock (also know as Bottom navigation or Bottom bar) is a UI element that provides navigation options to the user. Dock sticks to the bottom of the screen
- component:
dock - part:
dock-label - modifier:
dock-active - size:
dock-xs,dock-sm,dock-md,dock-lg,dock-xl
<div class="dock {MODIFIER}">{CONTENT}</div>where content is a list of buttons:
<button>
<svg>{icon}</svg>
<span class="dock-label">Text</span>
</button>- {MODIFIER} is optional and can have one of the size class names
- To make a button active, add
dock-activeclass to the button - add
<meta name="viewport" content="viewport-fit=cover">is required for responsivness of the dock in iOS
Drawer is a grid layout that can show/hide a sidebar on the left or right side of the page
- component:
drawer - part:
drawer-toggle,drawer-content,drawer-side,drawer-overlay - placement:
drawer-end - modifier:
drawer-open
<div class="drawer {MODIFIER}">
<input id="my-drawer" type="checkbox" class="drawer-toggle" />
<div class="drawer-content">{CONTENT}</div>
<div class="drawer-side">{SIDEBAR}</div>
</div>where {CONTENT} can be navbar, site content, footer, etc and {SIDEBAR} can be a menu like:
<ul class="menu p-4 w-80 min-h-full bg-base-100 text-base-content">
<li><a>Item 1</a></li>
<li><a>Item 2</a></li>
</ul>- {MODIFIER} is optional and can have one of the modifier/placement class names
idis required for thedrawer-toggleinput. changemy-drawerto a unique id according to your needslg:drawer-opencan be used to make sidebar visible on larger screensdrawer-toggleis a hidden checkbox. Use label with "for" attribute to toggle state- if you want to open the drawer when a button is clicked, use
<label for="my-drawer" class="btn drawer-button">Open drawer</label>wheremy-draweris the id of thedrawer-toggleinput - when using drawer, every page content must be inside
drawer-contentelement. for example navbar, footer, etc should not be outside ofdrawer
Dropdown can open a menu or any other element when the button is clicked
- component:
dropdown - part:
dropdown-content - placement:
dropdown-start,dropdown-center,dropdown-end,dropdown-top,dropdown-bottom,dropdown-left,dropdown-right - modifier:
dropdown-hover,dropdown-open
Using details and summary
<details class="dropdown">
<summary>Button</summary>
<ul class="dropdown-content">{CONTENT}</ul>
</details>Using popover API
<button popovertarget="{id}" style="anchor-name:--{anchor}">{button}</button>
<ul class="dropdown-content" popover id="{id}" style="position-anchor:--{anchor}">{CONTENT}</ul>Using CSS focus
<div class="dropdown">
<div tabindex="0" role="button">Button</div>
<ul tabindex="0" class="dropdown-content">{CONTENT}</ul>
</div>- {MODIFIER} is optional and can have one of the modifier/placement class names
- replace
{id}and{anchor}with a unique name - For CSS focus dropdowns, use
tabindex="0"androle="button"on the button - The content can be any HTML element (not just
<ul>)
Fieldset is a container for grouping related form elements. It includes fieldset-legend as a title and label as a description
- Component:
fieldset,label - Parts:
fieldset-legend
<fieldset class="fieldset">
<legend class="fieldset-legend">{title}</legend>
{CONTENT}
<p class="label">{description}</p>
</fieldset>- You can use any element as a direct child of fieldset to add form elements
File Input is a an input field for uploading files
- Component:
file-input - Style:
file-input-ghost - Color:
file-input-neutral,file-input-primary,file-input-secondary,file-input-accent,file-input-info,file-input-success,file-input-warning,file-input-error - Size:
file-input-xs,file-input-sm,file-input-md,file-input-lg,file-input-xl
<input type="file" class="file-input {MODIFIER}" />- {MODIFIER} is optional and can have one of each style/color/size class names
Filter is a group of radio buttons. Choosing one of the options will hide the others and shows a reset button next to the chosen option
- component:
filter - part:
filter-reset
Using HTML form
<form class="filter">
<input class="btn btn-square" type="reset" value="×"/>
<input class="btn" type="radio" name="{NAME}" aria-label="Tab 1 title"/>
<input class="btn" type="radio" name="{NAME}" aria-label="Tab 2 title"/>
</form>Without HTML form
<div class="filter">
<input class="btn filter-reset" type="radio" name="{NAME}" aria-label="×"/>
<input class="btn" type="radio" name="{NAME}" aria-label="Tab 1 title"/>
<input class="btn" type="radio" name="{NAME}" aria-label="Tab 2 title"/>
</div>- replace
{NAME}with proper value, according to the context of the filter - Each set of radio inputs must have unique
nameattributes to avoid conflicts - Use
<form>tag when possible and only use<div>if you can't use a HTML form for some reason - Use
filter-resetclass for the reset button
Footer can contain logo, copyright notice, and links to other pages
- component:
footer - part:
footer-title - placement:
footer-center - direction:
footer-horizontal,footer-vertical
<footer class="footer {MODIFIER}">{CONTENT}</footer>where content can contain several <nav> tags with footer-title and links inside
- {MODIFIER} is optional and can have one of each placement/direction class names
- try to use
sm:footer-horizontalto make footer responsive - suggestion - use
base-200for background color
Hero is a component for displaying a large box or image with a title and description
- component:
hero - part:
hero-content,hero-overlay
<div class="hero {MODIFIER}">{CONTENT}</div>- {MODIFIER} is optional
- Use
hero-contentfor the text content - Use
hero-overlayinside the hero to overlay the background image with a color - Content can contain a figure
Indicators are used to place an element on the corner of another element
- component:
indicator - part:
indicator-item - placement:
indicator-start,indicator-center,indicator-end,indicator-top,indicator-middle,indicator-bottom
<div class="indicator">
<span class="indicator-item">{indicator content}</span>
<div>{main content}</div>
</div>- Add all indicator elements (with
indicator-itemclass) before the main content - {placement} is optional and can have one of each horizontal/vertical class names. default is
indicator-end indicator-top
Text Input is a simple input field
- component:
input - style:
input-ghost - color:
input-neutral,input-primary,input-secondary,input-accent,input-info,input-success,input-warning,input-error - size:
input-xs,input-sm,input-md,input-lg,input-xl
<input type="{type}" placeholder="Type here" class="input {MODIFIER}" />- {MODIFIER} is optional and can have one of each style/color/size class names
- Can be used with any input field type (text, password, email, etc.)
- Use
inputclass for the parent when you have more than one element inside input
Join is a container for grouping multiple items, it can be used to group buttons, inputs, etc. Join applies border radius to the first and last item. Join can be used to create a horizontal or vertical list of items
- component:
join,join-item - direction:
join-vertical,join-horizontal
<div class="join {MODIFIER}">{CONTENT}</div>- {MODIFIER} is optional and can have one of the direction class names
- Any direct child of the join element will get joined together
- Any element with
join-itemwill be affected - Use
lg:join-horizontalfor responsive layouts
Kbd is used to display keyboard shortcuts
- component:
kbd - size:
kbd-xs,kbd-sm,kbd-md,kbd-lg,kbd-xl
<kbd class="kbd {MODIFIER}">K</kbd>- {MODIFIER} is optional and can have one of the size class names
Label is used to provide a name or title for an input field. Label can be placed before or after the field
- component:
label,floating-label
For regular label:
<label class="input">
<span class="label">{label text}</span>
<input type="text" placeholder="Type here" />
</label>For floating label:
<label class="floating-label">
<input type="text" placeholder="Type here" class="input" />
<span>{label text}</span>
</label>- The
inputclass is for styling the parent element which contains the input field and label, so the label does not have the 'input' class - Use
floating-labelfor the parent of an input field and a span that floats above the input field when the field is focused
Link adds the missing underline style to links
- component:
link - style:
link-hover - color:
link-neutral,link-primary,link-secondary,link-accent,link-success,link-info,link-warning,link-error
<a class="link {MODIFIER}">Click me</a>- {MODIFIER} is optional and can have one of the modifier class names
List is a vertical layout to display information in rows
- Component:
list,list-row - Modifier:
list-col-wrap,list-col-grow
<ul class="list">
<li class="list-row">{CONTENT}</li>
</ul>- Use
list-rowfor each item inside the list - By default, the second child of the
list-rowwill fill the remaining space. You can uselist-col-growon another child to make it fill the remaining space instead - Use
list-col-wrapto force an item to wrap to the next line
Loading shows an animation to indicate that something is loading
- component:
loading - style:
loading-spinner,loading-dots,loading-ring,loading-ball,loading-bars,loading-infinity - size:
loading-xs,loading-sm,loading-md,loading-lg,loading-xl
<span class="loading {MODIFIER}"></span>- {MODIFIER} is optional and can have one of the style/size class names
Mask crops the content of the element to common shapes
- component:
mask - style:
mask-squircle,mask-heart,mask-hexagon,mask-hexagon-2,mask-decagon,mask-pentagon,mask-diamond,mask-square,mask-circle,mask-star,mask-star-2,mask-triangle,mask-triangle-2,mask-triangle-3,mask-triangle-4 - modifier:
mask-half-1,mask-half-2
<img class="mask {MODIFIER}" src="{image-url}" />- {MODIFIER} is required and can have one of the style/modifier class names
- You can change the shape of any element using
maskclass names - You can set custom sizes using
w-*andh-*
Menu is used to display a list of links vertically or horizontally
- component:
menu - part:
menu-title,menu-dropdown,menu-dropdown-toggle - modifier:
menu-disabled,menu-active,menu-focus,menu-dropdown-show - size:
menu-xs,menu-sm,menu-md,menu-lg,menu-xl - direction:
menu-vertical,menu-horizontal
Vertical menu:
<ul class="menu">
<li><button>Item</button></li>
</ul>Horizontal menu:
<ul class="menu menu-horizontal">
<li><button>Item</button></li>
</ul>- {MODIFIER} is optional and can have one of the modifier/size/direction class names
- Use
lg:menu-horizontalfor responsive layouts - Use
menu-titlefor list item title - Use
<details>tag to make submenus collapsible - Use
menu-dropdownandmenu-dropdown-toggleto toggle the dropdown using JS
Browser mockup shows a box that looks like a browser window
- component:
mockup-browser - part:
mockup-browser-toolbar
<div class="mockup-browser">
<div class="mockup-browser-toolbar">
{toolbar content}
</div>
<div>{CONTENT}</div>
</div>- For a default mockup, use just
mockup-browserclass name - To set a URL in toolbar, add a div with
inputclass
Code mockup is used to show a block of code in a box that looks like a code editor
- component:
mockup-code
<div class="mockup-code">
<pre data-prefix="$"><code>npm i daisyui</code></pre>
</div>- Use
<pre data-prefix="{prefix}">to show a prefix before each line - Use
<code>tag to add code syntax highlighting (requires additional library) - To highlight a line, add background/text color
Phone mockup shows a mockup of an iPhone
- component:
mockup-phone - part:
mockup-phone-camera,mockup-phone-display
<div class="mockup-phone">
<div class="mockup-phone-camera"></div>
<div class="mockup-phone-display">{CONTENT}</div>
</div>- Inside
mockup-phone-displayyou can add anything
Window mockup shows a box that looks like an operating system window
- component:
mockup-window
<div class="mockup-window">
<div>{CONTENT}</div>
</div>Modal is used to show a dialog or a box when you click a button
- component:
modal - part:
modal-box,modal-action,modal-backdrop,modal-toggle - modifier:
modal-open - placement:
modal-top,modal-middle,modal-bottom,modal-start,modal-end
Using HTML dialog element
<button onclick="my_modal.showModal()">Open modal</button>
<dialog id="my_modal" class="modal">
<div class="modal-box">{CONTENT}</div>
<form method="dialog" class="modal-backdrop"><button>close</button></form>
</dialog>Using checkbox (legacy)
<label for="my-modal" class="btn">Open modal</label>
<input type="checkbox" id="my-modal" class="modal-toggle" />
<div class="modal">
<div class="modal-box">{CONTENT}</div>
<label class="modal-backdrop" for="my-modal">Close</label>
</div>Using anchor links (legacy)
<a href="#my-modal" class="btn">Open modal</a>
<div class="modal" id="my-modal">
<div class="modal-box">{CONTENT}</div>
</div>- {MODIFIER} is optional and can have one of the modifier/placement class names
- Add
tabindex="0"to make modal focusable - Use unique IDs for each modal
- For HTML dialog element modals, add
<form method="dialog">for closing the modal with submit
Navbar is used to show a navigation bar on the top of the page
- component:
navbar - part:
navbar-start,navbar-center,navbar-end
<div class="navbar">{CONTENT}</div>- use
navbar-start,navbar-center,navbar-endto position content horizontally - put anything inside each section
- suggestion - use
base-200for background color
Pagination is a group of buttons
- component:
join - part:
join-item - direction:
join-vertical,join-horizontal
<div class="join">{CONTENT}</div>- Use
join-itemfor each button or link inside the pagination - Use
btnclass for styling pagination items
Progress bar can be used to show the progress of a task or to show the passing of time
- component:
progress - color:
progress-neutral,progress-primary,progress-secondary,progress-accent,progress-info,progress-success,progress-warning,progress-error
<progress class="progress {MODIFIER}" value="50" max="100"></progress>- {MODIFIER} is optional and can have one of the color class names
- You must specify value and max attributes
Radial progress can be used to show the progress of a task or to show the passing of time
- component:
radial-progress
<div class="radial-progress" style="--value:70;" aria-valuenow="70" role="progressbar">70%</div>- The
--valueCSS variable and text must be a number between 0 and 100 - you need to add
aria-valuenow="{value}",aria-valuenow={value}so screen readers can properly read value and also show that its a progress element to them - Use
divinstead of progress because browsers can't show text inside progress tag - Use
--sizefor setting size (default 5rem) and--thicknessto set how thick the indicator is
Radio buttons allow the user to select one option
- component:
radio - color:
radio-neutral,radio-primary,radio-secondary,radio-accent,radio-success,radio-warning,radio-info,radio-error - size:
radio-xs,radio-sm,radio-md,radio-lg,radio-xl
<input type="radio" name="{name}" class="radio {MODIFIER}" />- {MODIFIER} is optional and can have one of the size/color class names
- Replace {name} with a unique name for the radio group
- Each set of radio inputs should have unique
nameattributes to avoid conflicts with other sets of radio inputs on the same page
Range slider is used to select a value by sliding a handle
- component:
range - color:
range-neutral,range-primary,range-secondary,range-accent,range-success,range-warning,range-info,range-error - size:
range-xs,range-sm,range-md,range-lg,range-xl
<input type="range" min="0" max="100" value="40" class="range {MODIFIER}" />- {MODIFIER} is optional and can have one of each color/size class names
- You must specify
minandmaxattributes
Rating is a set of radio buttons that allow the user to rate something
- component:
rating - modifier:
rating-half,rating-hidden - size:
rating-xs,rating-sm,rating-md,rating-lg,rating-xl
<div class="rating {MODIFIER}">
<input type="radio" name="rating-1" class="mask mask-star" />
</div>- {MODIFIER} is optional and can have one of the modifier/size class names
- Each set of rating inputs should have unique
nameattributes to avoid conflicts with other ratings on the same page - Add
rating-hiddenfor the first radio to make it hidden so user can clear the rating
Select is used to pick a value from a list of options
- component:
select - style:
select-ghost - color:
select-neutral,select-primary,select-secondary,select-accent,select-info,select-success,select-warning,select-error - size:
select-xs,select-sm,select-md,select-lg,select-xl
<select class="select {MODIFIER}">
<option>Option</option>
</select>- {MODIFIER} is optional and can have one of each style/color/size class names
Skeleton is a component that can be used to show a loading state
- component:
skeleton
<div class="skeleton"></div>- Add
h-*andw-*utility classes to set height and width
Stack visually puts elements on top of each other
- Component:
stack - Modifier:
stack-top,stack-bottom,stack-start,stack-end
<div class="stack {MODIFIER}">{CONTENT}</div>- {MODIFIER} is optional and can have one of the modifier class names
- You can use
w-*andh-*classes to set the width and height of the stack, making all items the same size
Stat is used to show numbers and data in a block
- Component:
stats - Part:
stat,stat-title,stat-value,stat-desc,stat-figure,stat-actions - Direction:
stats-horizontal,stats-vertical
<div class="stats {MODIFIER}">
<div class="stat">{CONTENT}</div>
</div>- {MODIFIER} is optional and can have one of the direction class names
- It's horizontal by default but you can make it vertical with the
stats-verticalclass - Content includes
stat-title,stat-value,stat-descinside astat
Status is a really small icon to visually show the current status of an element, like online, offline, error, etc
- Component:
status - Color:
status-neutral,status-primary,status-secondary,status-accent,status-info,status-success,status-warning,status-error - Size:
status-xs,status-sm,status-md,status-lg,status-xl
<span class="status {MODIFIER}"></span>- {MODIFIER} is optional and can have one of the color/size class names
- This component does not render anything visible
Steps can be used to show a list of steps in a process
- Component:
steps - Part:
step,step-icon - Color:
step-neutral,step-primary,step-secondary,step-accent,step-info,step-success,step-warning,step-error - Direction:
steps-vertical,steps-horizontal
<ul class="steps {MODIFIER}">
<li class="step">{step content}</li>
</ul>- {MODIFIER} is optional and can have one of each direction/color class names
- To make a step active, add the
step-primaryclass - You can add an icon in each step using
step-iconclass - To display data in
data-content,usedata-content="{value}"at the<li>
Swap allows you to toggle the visibility of two elements using a checkbox or a class name
- Component:
swap - Part:
swap-on,swap-off,swap-indeterminate - Modifier:
swap-active - Style:
swap-rotate,swap-flip
Using checkbox
<label class="swap {MODIFIER}">
<input type="checkbox" />
<div class="swap-on">{content when active}</div>
<div class="swap-off">{content when inactive}</div>
</label>Using class name
<div class="swap {MODIFIER}">
<div class="swap-on">{content when active}</div>
<div class="swap-off">{content when inactive}</div>
</div>- {MODIFIER} is optional and can have one of the modifier/style class names
- Use only a hidden checkbox to control swap state or add/remove the
swap-activeclass using JS to control state - To show something when the checkbox is indeterminate, use
swap-indeterminateclass
Tabs can be used to show a list of links in a tabbed format
- Component:
tabs - Part:
tab,tab-content - Style:
tabs-box,tabs-border,tabs-lift - Modifier:
tab-active,tab-disabled - Placement:
tabs-top,tabs-bottom
Using buttons:
<div role="tablist" class="tabs {MODIFIER}">
<button role="tab" class="tab">Tab</button>
</div>Using radio inputs:
<div role="tablist" class="tabs tabs-box">
<input type="radio" name="my_tabs" class="tab" aria-label="Tab" />
</div>- {MODIFIER} is optional and can have one of the style/size class names
- Radio inputs are needed for tab content to work with tab click
- If tabs gets a background then every tab inside it becomes rounded from both top corners
Table can be used to show a list of data in a table format
- Component:
table - Modifier:
table-zebra,table-pin-rows,table-pin-cols - Size:
table-xs,table-sm,table-md,table-lg,table-xl
<div class="overflow-x-auto">
<table class="table {MODIFIER}">
<thead>
<tr>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<th></th>
</tr>
</tbody>
</table>
</div>- {MODIFIER} is optional and can have one of each modifier/size class names
- The
overflow-x-autoclass is added to the wrapper div to make the table horizontally scrollable on smaller screens
Textarea allows users to enter text in multiple lines
- Component:
textarea - Style:
textarea-ghost - Color:
textarea-neutral,textarea-primary,textarea-secondary,textarea-accent,textarea-info,textarea-success,textarea-warning,textarea-error - Size:
textarea-xs,textarea-sm,textarea-md,textarea-lg,textarea-xl
<textarea class="textarea {MODIFIER}" placeholder="Bio"></textarea>- {MODIFIER} is optional and can have one of each style/color/size class names
If a checked checkbox input or a checked radio input with theme-controller class exists in the page, The page will have the same theme as that input's value
- component:
theme-controller
<input type="checkbox" value="{theme-name}" class="theme-controller" />- The value attribute of the input element should be a valid daisyUI theme name
Timeline component shows a list of events in chronological order
- Component:
timeline - Part:
timeline-start,timeline-middle,timeline-end - Modifier:
timeline-snap-icon,timeline-box,timeline-compact - Direction:
timeline-vertical,timeline-horizontal
<ul class="timeline {MODIFIER}">
<li>
<div class="timeline-start">{start}</div>
<div class="timeline-middle">{icon}</div>
<div class="timeline-end">{end}</div>
</li>
</ul>- {MODIFIER} is optional and can have one of the modifier/direction class names
- To make a vertical timeline, add the
timeline-verticalclass to theulelement or just do nothing (because its the default style.) - Add
timeline-snap-iconto snap the icon to the start instead of middle - Add the
timeline-compactclass to force all items on one side
Toast is a wrapper to stack elements, positioned on the corner of page
- Component:
toast - Placement:
toast-start,toast-center,toast-end,toast-top,toast-middle,toast-bottom
<div class="toast {MODIFIER}">{CONTENT}</div>- {MODIFIER} is optional and can have one of the placement class names
Toggle is a checkbox that is styled to look like a switch button
- Component:
toggle - Color:
toggle-primary,toggle-secondary,toggle-accent,toggle-neutral,toggle-success,toggle-warning,toggle-info,toggle-error - Size:
toggle-xs,toggle-sm,toggle-md,toggle-lg,toggle-xl
<input type="checkbox" class="toggle {MODIFIER}" />- {MODIFIER} is optional and can have one of each color/size class names
Validator class changes the color of form elements to error or success based on input's validation rules
- component:
validator - part:
validator-hint
<input type="{type}" class="input validator" required />
<p class="validator-hint">Error message</p>- Use with
input,select,textarea