daisyui
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesedaisyUI 5
daisyUI 5
daisyUI 5 is a CSS library for Tailwind CSS 4
daisyUI 5 provides class names for common UI components
daisyUI 5 是适用于 Tailwind CSS 4 的 CSS 库
daisyUI 5 为常见 UI 组件提供类名
daisyUI 5 install notes
daisyUI 5 安装说明
- daisyUI 5 requires Tailwind CSS 4
- file is deprecated in Tailwind CSS v4. do not use
tailwind.config.js. Tailwind CSS v4 only needstailwind.config.jsin the CSS file if it's a node dependency.@import "tailwindcss"; - daisyUI 5 can be installed using and then adding
npm i -D daisyui@latestto the CSS file@plugin "daisyui"; - 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:
html
<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)
css
@import "tailwindcss";
@plugin "daisyui";- daisyUI 5 需要依赖 Tailwind CSS 4
- 文件在 Tailwind CSS v4 中已被弃用,请不要使用
tailwind.config.js。如果是 Node 依赖项,Tailwind CSS v4 仅需在 CSS 文件中添加tailwind.config.js@import "tailwindcss"; - 可以通过 安装 daisyUI 5,然后在 CSS 文件中添加
npm i -D daisyui@latest@plugin "daisyui"; - daisyUI 建议作为依赖项安装,但如果确实想通过 CDN 使用,可以使用 Tailwind CSS 和 daisyUI 的 CDN 文件:
html
<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>- 如果是 Node 依赖项,包含 Tailwind CSS 和 daisyUI 的 CSS 文件如下:
css
@import "tailwindcss";
@plugin "daisyui";daisyUI 5 usage rules
daisyUI 5 使用规则
- 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 sets a custom horizontal padding to a
btn px-10btn - 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 example
!sets a custom background color to abtn bg-red-500!forcefully. This is a last resort solution and should be used sparinglybtn - 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 and
flexfor layout, it should be responsive using Tailwind CSS responsive utility prefixes.grid - 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 to body unless it's necessary
bg-base-100 text-base-content - 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
- : the required component class
component - : a child part of a component
part - : sets a specific style to component or part
style - : changes the behavior of component or part
behavior - : sets a specific color to component or part
color - : sets a specific size to component or part
size - : sets a specific placement to component or part
placement - : sets a specific direction to component or part
direction - : modifies the component or part in a specific way
modifier - : prefixes for utility classes that conditionally apply styles. syntax is
variantvariant:utility-class
- 我们可以通过为 HTML 元素添加 daisyUI 类名来设置样式。可添加组件类名、该组件可用的子部件类名以及修饰符类名
- 如果使用现有 daisyUI 类无法实现自定义样式,可以使用 Tailwind CSS 工具类来定制组件。例如 为
btn px-10设置自定义水平内边距btn - 如果因 CSS 优先级问题,使用 Tailwind CSS 工具类无法覆盖 daisyUI 样式,可以在 Tailwind CSS 工具类末尾添加 强制覆盖现有样式。例如
!强制为btn bg-red-500!设置自定义背景色。这是最后的解决方案,应谨慎使用btn - 如果 daisyUI 中没有特定组件或类似组件,可以使用 Tailwind CSS 工具类创建自定义组件
- 使用 Tailwind CSS 的 和
flex进行布局时,应使用 Tailwind CSS 响应式工具类前缀实现响应式效果grid - 仅允许使用现有 daisyUI 类名或 Tailwind CSS 工具类
- 理想情况下,无需编写任何自定义 CSS。优先使用 daisyUI 类名或 Tailwind CSS 工具类
- 建议 - 如果需要占位图片,使用 https://picsum.photos/200/300 并设置所需尺寸
- 建议 - 设计时,除非必要,不要添加自定义字体
- 除非必要,不要为 body 添加
bg-base-100 text-base-content - 设计决策请遵循《Refactoring UI》书籍中的最佳实践
daisyUI 5 类名分为以下类别。这些类别名称仅作参考,不会在实际代码中使用
- : 必填的组件类
component - : 组件的子部件类
part - : 为组件或子部件设置特定样式
style - : 改变组件或子部件的行为
behavior - : 为组件或子部件设置特定颜色
color - : 为组件或子部件设置特定尺寸
size - : 为组件或子部件设置特定位置
placement - : 为组件或子部件设置特定方向
direction - : 以特定方式修改组件或子部件
modifier - : 工具类的前缀,用于条件应用样式,语法为
variantvariant:utility-class
Config
配置
daisyUI 5 config docs: https://daisyui.com/docs/config/
daisyUI without config:
css
@plugin "daisyui";daisyUI config with theme only:
lightcss
@plugin "daisyui" {
themes: light --default;
}daisyUI with all the default configs:
css
@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 to the element
root scrollbar gutter is excluded. prefix is used for all daisyUI classes and console.log is disabled
data-theme="THEME_NAME"<html>daisy-css
@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;
}daisyUI 5 配置文档:https://daisyui.com/docs/config/
不使用配置的 daisyUI:
css
@plugin "daisyui";仅启用 主题的 daisyUI 配置:
lightcss
@plugin "daisyui" {
themes: light --default;
}包含所有默认配置的 daisyUI:
css
@plugin "daisyui" {
themes: light --default, dark --prefersdark;
root: ":root";
include: ;
exclude: ;
prefix: ;
logs: true;
}配置示例:
以下配置中,启用了所有内置主题,其中 bumblebee 为默认主题,synthwave 为偏好深色主题(默认深色模式)
所有其他主题均已启用,可通过为 元素添加 来使用
排除了根滚动条间距,所有 daisyUI 类均使用 前缀,禁用控制台日志
<html>data-theme="THEME_NAME"daisy-css
@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;
}daisyUI 5 colors
daisyUI 5 颜色
daisyUI color names
daisyUI 颜色名称
- : Primary brand color, The main color of your brand
primary - : Foreground content color to use on primary color
primary-content - : Secondary brand color, The optional, secondary color of your brand
secondary - : Foreground content color to use on secondary color
secondary-content - : Accent brand color, The optional, accent color of your brand
accent - : Foreground content color to use on accent color
accent-content - : Neutral dark color, For not-saturated parts of UI
neutral - : Foreground content color to use on neutral color
neutral-content - :-100 Base surface color of page, used for blank backgrounds
base-100 - :-200 Base color, darker shade, to create elevations
base-200 - :-300 Base color, even more darker shade, to create elevations
base-300 - : Foreground content color to use on base color
base-content - : Info color, For informative/helpful messages
info - : Foreground content color to use on info color
info-content - : Success color, For success/safe messages
success - : Foreground content color to use on success color
success-content - : Warning color, For warning/caution messages
warning - : Foreground content color to use on warning color
warning-content - : Error color, For error/danger/destructive messages
error - : Foreground content color to use on error color
error-content
- : 品牌主色调,你的品牌主要颜色
primary - : 在主色调上使用的前景内容颜色
primary-content - : 品牌次要色调,品牌可选的次要颜色
secondary - : 在次要色调上使用的前景内容颜色
secondary-content - : 品牌强调色调,品牌可选的强调颜色
accent - : 在强调色调上使用的前景内容颜色
accent-content - : 中性深色,用于 UI 中饱和度较低的部分
neutral - : 在中性深色上使用的前景内容颜色
neutral-content - : 页面基础表面色,用于空白背景
base-100 - : 基础色,更深的色调,用于创建层次感
base-200 - : 基础色,更深的色调,用于创建层次感
base-300 - : 在基础色上使用的前景内容颜色
base-content - : 信息色,用于提示性/帮助类消息
info - : 在信息色上使用的前景内容颜色
info-content - : 成功色,用于成功/安全类消息
success - : 在成功色上使用的前景内容颜色
success-content - : 警告色,用于警告/提醒类消息
warning - : 在警告色上使用的前景内容颜色
warning-content - : 错误色,用于错误/危险/破坏性消息
error - : 在错误色上使用的前景内容颜色
error-content
daisyUI color rules
daisyUI 颜色规则
- 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, will use the primary color for the background
bg-primary - daisyUI color names include variables as value so they can change based the theme
- There's no need to use for daisyUI color names
dark: - 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 ) is used, it will be same red color on all themes
red-500 - If a daisyUI color name (like ) is used, it will change color based on the theme
primary - Using Tailwind CSS color names for text colors should be avoided because Tailwind CSS color on
text-gray-800would be unreadable on a dark theme - because on dark theme,bg-base-100is a dark colorbg-base-100 - colors should have a good contrast compared to their associated colors
*-content - suggestion - when designing a page use colors for majority of the page. use
base-*color for important elementsprimary
- daisyUI 为 Tailwind CSS 颜色添加了语义化颜色名称
- daisyUI 颜色名称可用于工具类,与其他 Tailwind CSS 颜色名称用法一致。例如 会将背景设置为主色调
bg-primary - daisyUI 颜色名称的值包含变量,因此会根据主题变化
- daisyUI 颜色名称无需使用 前缀
dark: - 理想情况下,应仅使用 daisyUI 颜色名称,以便颜色可根据主题自动变化
- 如果使用 Tailwind CSS 颜色名称(如 ),它在所有主题中都是相同的红色
red-500 - 如果使用 daisyUI 颜色名称(如 ),它会根据主题改变颜色
primary - 应避免使用 Tailwind CSS 颜色名称设置文本颜色,因为在深色主题中,是深色,
bg-base-100会变得难以阅读text-gray-800 - 颜色应与其关联颜色具有良好的对比度
*-content - 建议 - 设计页面时,大部分页面使用 颜色,重要元素使用
base-*颜色primary
daisyUI custom theme with custom colors
自定义颜色的 daisyUI 自定义主题
A CSS file with Tailwind CSS, daisyUI and a custom daisyUI theme looks like this:
css
@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 */
}包含 Tailwind CSS、daisyUI 和自定义 daisyUI 主题的 CSS 文件如下:
css
@import "tailwindcss";
@plugin "daisyui";
@plugin "daisyui/theme" {
name: "mytheme";
default: true; /* 设置为默认主题 */
prefersdark: false; /* 设置为默认深色模式(prefers-color-scheme:dark) */
color-scheme: light; /* 浏览器提供的 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; /* 选择器(复选框、开关、徽章)的边框半径 */
--radius-field: 0.25rem; /* 字段(按钮、输入框、选择器、标签页)的边框半径 */
--radius-box: 0.5rem; /* 容器(卡片、模态框、提示框)的边框半径 */
/* --radius-* 的推荐值:0rem, 0.25rem, 0.5rem, 1rem, 2rem */
--size-selector: 0.25rem; /* 选择器(复选框、开关、徽章)的基础尺寸。除非特意要更大的选择器,否则值必须为 0.25rem。如需更大,可设为 0.28125 或 0.3125;如需更小,可设为 0.21875 或 0.1875 */
--size-field: 0.25rem; /* 字段(按钮、输入框、选择器、标签页)的基础尺寸。除非特意要更大的字段,否则值必须为 0.25rem。如需更大,可设为 0.28125 或 0.3125;如需更小,可设为 0.21875 或 0.1875 */
--border: 1px; /* 边框尺寸。除非特意要更粗的边框,否则值必须为 1px。如需更粗,可设为 1.5px 或 2px;如需更细,可设为 0.5px */
--depth: 1; /* 仅 0 或 1 – 为组件添加阴影和细微的 3D 层次感 */
--noise: 0; /* 仅 0 或 1 - 为组件添加细微的噪点(颗粒)效果 */
}Rules
规则
- 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.
- 上述所有 CSS 变量都是必填的
- 颜色可以是 OKLCH、十六进制或其他格式
- 如果生成自定义主题,请不要包含示例中的注释,仅提供代码即可
用户可以使用 https://daisyui.com/theme-generator/ 可视化工具创建自己的主题
daisyUI 5 components
daisyUI 5 组件
accordion
折叠面板
Accordion is used for showing and hiding content but only one item can stay open at a time
折叠面板用于显示和隐藏内容,但同一时间只能有一个项处于展开状态
Class names
类名
- component:
collapse - part: ,
collapse-titlecollapse-content - modifier: ,
collapse-arrow,collapse-plus,collapse-opencollapse-close
- 组件类:
collapse - 子部件类:,
collapse-titlecollapse-content - 修饰符类:,
collapse-arrow,collapse-plus,collapse-opencollapse-close
Syntax
语法
html
<div class="collapse {MODIFIER}">{CONTENT}</div>where content is:
html
<input type="radio" name="{name}" checked="{checked}" />
<div class="collapse-title">{title}</div>
<div class="collapse-content">{CONTENT}</div>html
<div class="collapse {MODIFIER}">{CONTENT}</div>其中内容为:
html
<input type="radio" name="{name}" checked="{checked}" />
<div class="collapse-title">{title}</div>
<div class="collapse-content">{CONTENT}</div>Rules
规则
- {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 with
{checked}if you want the accordion to be open by defaultchecked="checked"
- {MODIFIER} 是可选的,可以使用任意一个修饰符类名
- 折叠面板使用单选框输入。所有同名的单选框协同工作,同一时间只能有一个处于展开状态
- 如果页面上有多组折叠面板项,每组单选框使用不同的名称
- 将 {name} 替换为折叠面板组的唯一名称
- 如果希望折叠面板默认展开,将 替换为
{checked}checked="checked"
alert
提示框
Alert informs users about important events
提示框用于向用户告知重要事件
Class names
类名
- component:
alert - style: ,
alert-outline,alert-dashalert-soft - color: ,
alert-info,alert-success,alert-warningalert-error - direction: ,
alert-verticalalert-horizontal
- 组件类:
alert - 样式类:,
alert-outline,alert-dashalert-soft - 颜色类:,
alert-info,alert-success,alert-warningalert-error - 方向类:,
alert-verticalalert-horizontal
Syntax
语法
html
<div role="alert" class="alert {MODIFIER}">{CONTENT}</div>html
<div role="alert" class="alert {MODIFIER}">{CONTENT}</div>Rules
规则
- {MODIFIER} is optional and can have one of each style/color/direction class names
- Add for responsive layouts
sm:alert-horizontal
- {MODIFIER} 是可选的,可以使用任意一个样式/颜色/方向类名
- 使用 实现响应式布局
sm:alert-horizontal
avatar
头像
Avatars are used to show a thumbnail
头像用于显示缩略图
Class names
类名
- component: ,
avataravatar-group - modifier: ,
avatar-online,avatar-offlineavatar-placeholder
- 组件类:,
avataravatar-group - 修饰符类:,
avatar-online,avatar-offlineavatar-placeholder
Syntax
语法
html
<div class="avatar {MODIFIER}">
<div>
<img src="{image-url}" />
</div>
</div>html
<div class="avatar {MODIFIER}">
<div>
<img src="{image-url}" />
</div>
</div>Rules
规则
- {MODIFIER} is optional and can have one of the modifier class names
- Use for containing multiple avatars
avatar-group - You can set custom sizes using and
w-*h-* - You can use mask classes such as ,
mask-squircle,mask-hexagonmask-triangle
- {MODIFIER} 是可选的,可以使用任意一个修饰符类名
- 使用 包含多个头像
avatar-group - 可以使用 和
w-*设置自定义尺寸h-* - 可以使用遮罩类,如 ,
mask-squircle,mask-hexagonmask-triangle
badge
徽章
Badges are used to inform the user of the status of specific data
徽章用于告知用户特定数据的状态
Class names
类名
- component:
badge - style: ,
badge-outline,badge-dash,badge-softbadge-ghost - color: ,
badge-neutral,badge-primary,badge-secondary,badge-accent,badge-info,badge-success,badge-warningbadge-error - size: ,
badge-xs,badge-sm,badge-md,badge-lgbadge-xl
- 组件类:
badge - 样式类:,
badge-outline,badge-dash,badge-softbadge-ghost - 颜色类:,
badge-neutral,badge-primary,badge-secondary,badge-accent,badge-info,badge-success,badge-warningbadge-error - 尺寸类:,
badge-xs,badge-sm,badge-md,badge-lgbadge-xl
Syntax
语法
html
<span class="badge {MODIFIER}">Badge</span>html
<span class="badge {MODIFIER}">Badge</span>Rules
规则
- {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
- {MODIFIER} 是可选的,可以使用任意一个样式/颜色/尺寸类名
- 可用于文本或按钮内部
- 要创建空徽章,只需移除 span 标签之间的文本
breadcrumbs
面包屑
Breadcrumbs helps users to navigate
面包屑帮助用户导航
Class names
类名
- component:
breadcrumbs
- 组件类:
breadcrumbs
Syntax
语法
html
<div class="breadcrumbs">
<ul><li><a>Link</a></li></ul>
</div>html
<div class="breadcrumbs">
<ul><li><a>Link</a></li></ul>
</div>Rules
规则
- breadcrumbs only has one main class name
- Can contain icons inside the links
- If you set or the list gets larger than the container it will scroll
max-width
- 面包屑只有一个主类名
- 链接内部可以包含图标
- 如果设置了 或列表超出容器宽度,会自动滚动
max-width
button
按钮
Buttons allow the user to take actions
按钮允许用户执行操作
Class names
类名
- component:
btn - color: ,
btn-neutral,btn-primary,btn-secondary,btn-accent,btn-info,btn-success,btn-warningbtn-error - style: ,
btn-outline,btn-dash,btn-soft,btn-ghostbtn-link - behavior: ,
btn-activebtn-disabled - size: ,
btn-xs,btn-sm,btn-md,btn-lgbtn-xl - modifier: ,
btn-wide,btn-block,btn-squarebtn-circle
- 组件类:
btn - 颜色类:,
btn-neutral,btn-primary,btn-secondary,btn-accent,btn-info,btn-success,btn-warningbtn-error - 样式类:,
btn-outline,btn-dash,btn-soft,btn-ghostbtn-link - 行为类:,
btn-activebtn-disabled - 尺寸类:,
btn-xs,btn-sm,btn-md,btn-lgbtn-xl - 修饰符类:,
btn-wide,btn-block,btn-squarebtn-circle
Syntax
语法
html
<button class="btn {MODIFIER}">Button</button>html
<button class="btn {MODIFIER}">Button</button>Rules
规则
- {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 if you want to disable the button using a class name
tabindex="-1" role="button" aria-disabled="true"
- {MODIFIER} 是可选的,可以使用任意一个颜色/样式/行为/尺寸/修饰符类名
- btn 可用于任意 HTML 标签,如 ,
<button>,<a><input> - btn 可以在文本前后添加图标
- 如果想通过类名禁用按钮,设置
tabindex="-1" role="button" aria-disabled="true"
calendar
日历
Calendar includes styles for different calendar libraries
日历包含不同日历库的样式
Class names
类名
- component
cally (for Cally web component)pika-single (for the input field that opens Pikaday calendar)react-day-picker (for the DayPicker component)
- 组件类
cally (用于 Cally Web 组件)pika-single (用于打开 Pikaday 日历的输入框)react-day-picker (用于 DayPicker 组件)
Syntax
语法
For Cally:
html
<calendar-date class="cally">{CONTENT}</calendar-date>For Pikaday:
html
<input type="text" class="input pika-single">For React Day Picker:
html
<DayPicker className="react-day-picker">对于 Cally:
html
<calendar-date class="cally">{CONTENT}</calendar-date>对于 Pikaday:
html
<input type="text" class="input pika-single">对于 React Day Picker:
html
<DayPicker className="react-day-picker">Rules
规则
- daisyUI supports Cally, Pikaday, React Day Picker
- daisyUI 支持 Cally、Pikaday、React Day Picker
card
卡片
Class names
类名
- component:
card - part: ,
card-title,card-bodycard-actions - style: ,
card-bordercard-dash - modifier: ,
card-sideimage-full - size: ,
card-xs,card-sm,card-md,card-lgcard-xl
- 组件类:
card - 子部件类:,
card-title,card-bodycard-actions - 样式类:,
card-bordercard-dash - 修饰符类:,
card-sideimage-full - 尺寸类:,
card-xs,card-sm,card-md,card-lgcard-xl
Syntax
语法
html
<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>html
<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>Rules
规则
- {MODIFIER} is optional and can have one of the modifier class names and one of the size class names
- and
<figure>are optional<div class="card-body"> - can use for responsive layouts
sm:card-horizontal - If image is placed after , the image will be placed at the bottom
card-body
- {MODIFIER} 是可选的,可以使用任意一个修饰符类名和尺寸类名
- 和
<figure>是可选的<div class="card-body"> - 使用 实现响应式布局
sm:card-horizontal - 如果图片放在 之后,图片会显示在底部
card-body
carousel
轮播
Carousel show images or content in a scrollable area
轮播在可滚动区域展示图片或内容
Class names
类名
- component:
carousel - part:
carousel-item - modifier: ,
carousel-start,carousel-centercarousel-end - direction: ,
carousel-horizontalcarousel-vertical
- 组件类:
carousel - 子部件类:
carousel-item - 修饰符类:,
carousel-start,carousel-centercarousel-end - 方向类:,
carousel-horizontalcarousel-vertical
Syntax
语法
html
<div class="carousel {MODIFIER}">{CONTENT}</div>html
<div class="carousel {MODIFIER}">{CONTENT}</div>Rules
规则
- {MODIFIER} is optional and can have one of the modifier/direction class names
- Content is a list of divs:
carousel-item<div class="carousel-item"></div> - To create a full-width carousel, add to each carousel item
w-full
- {MODIFIER} 是可选的,可以使用任意一个修饰符/方向类名
- 内容是一系列 容器:
carousel-item<div class="carousel-item"></div> - 要创建全屏轮播,为每个 carousel item 添加
w-full
chat
聊天气泡
Chat bubbles are used to show one line of conversation and all its data, including the author image, author name, time, etc
聊天气泡用于展示一行对话及其所有数据,包括作者头像、作者名称、时间等
Class names
类名
- component:
chat - part: ,
chat-image,chat-header,chat-footerchat-bubble - placement: ,
chat-startchat-end - color: ,
chat-bubble-neutral,chat-bubble-primary,chat-bubble-secondary,chat-bubble-accent,chat-bubble-info,chat-bubble-success,chat-bubble-warningchat-bubble-error
- 组件类:
chat - 子部件类:,
chat-image,chat-header,chat-footerchat-bubble - 位置类:,
chat-startchat-end - 颜色类:,
chat-bubble-neutral,chat-bubble-primary,chat-bubble-secondary,chat-bubble-accent,chat-bubble-info,chat-bubble-success,chat-bubble-warningchat-bubble-error
Syntax
语法
html
<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>html
<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>Rules
规则
- {PLACEMENT} is required and must be either or
chat-startchat-end - {COLOR} is optional and can have one of the color class names
- To add an avatar, use and nest the avatar content inside
<div class="chat-image avatar">
- {PLACEMENT} 是必填的,必须是 或
chat-startchat-end - {COLOR} 是可选的,可以使用任意一个颜色类名
- 要添加头像,使用 并在内部嵌套头像内容
<div class="chat-image avatar">
checkbox
复选框
Checkboxes are used to select or deselect a value
复选框用于选择或取消选择值
Class names
类名
- component:
checkbox - color: ,
checkbox-primary,checkbox-secondary,checkbox-accent,checkbox-neutral,checkbox-success,checkbox-warning,checkbox-infocheckbox-error - size: ,
checkbox-xs,checkbox-sm,checkbox-md,checkbox-lgcheckbox-xl
- 组件类:
checkbox - 颜色类:,
checkbox-primary,checkbox-secondary,checkbox-accent,checkbox-neutral,checkbox-success,checkbox-warning,checkbox-infocheckbox-error - 尺寸类:,
checkbox-xs,checkbox-sm,checkbox-md,checkbox-lgcheckbox-xl
Syntax
语法
html
<input type="checkbox" class="checkbox {MODIFIER}" />html
<input type="checkbox" class="checkbox {MODIFIER}" />Rules
规则
- {MODIFIER} is optional and can have one of each color/size class names
- {MODIFIER} 是可选的,可以使用任意一个颜色/尺寸类名
collapse
折叠面板(独立版)
Collapse is used for showing and hiding content
折叠面板用于显示和隐藏内容
Class names
类名
- component:
collapse - part: ,
collapse-titlecollapse-content - modifier: ,
collapse-arrow,collapse-plus,collapse-opencollapse-close
- 组件类:
collapse - 子部件类:,
collapse-titlecollapse-content - 修饰符类:,
collapse-arrow,collapse-plus,collapse-opencollapse-close
Syntax
语法
html
<div tabindex="0" class="collapse {MODIFIER}">
<div class="collapse-title">{title}</div>
<div class="collapse-content">{CONTENT}</div>
</div>html
<div tabindex="0" class="collapse {MODIFIER}">
<div class="collapse-title">{title}</div>
<div class="collapse-content">{CONTENT}</div>
</div>Rules
规则
- {MODIFIER} is optional and can have one of the modifier class names
- instead of , you can use
tabindex="0"as a first child<input type="checkbox"> - Can also be a details/summary tag
- {MODIFIER} 是可选的,可以使用任意一个修饰符类名
- 可以用 作为第一个子元素替代
<input type="checkbox">tabindex="0" - 也可以使用 details/summary 标签
countdown
数字倒计时
Countdown gives you a transition effect when you change a number between 0 to 999
数字倒计时在数字 0 到 999 之间变化时提供过渡效果
Class names
类名
- component:
countdown
- 组件类:
countdown
Syntax
语法
html
<span class="countdown">
<span style="--value:{number};">number</span>
</span>html
<span class="countdown">
<span style="--value:{number};">number</span>
</span>Rules
规则
- The CSS variable and text must be a number between 0 and 999
--value - you need to change the span text and the CSS variable using JS
--value - you need to add and
aria-live="polite"so screen readers can properly read changesaria-label="{number}"
- CSS 变量和文本必须是 0 到 999 之间的数字
--value - 需要使用 JS 改变 span 文本和 CSS 变量
--value - 需要添加 和
aria-live="polite"以便屏幕阅读器正确读取变化aria-label="{number}"
diff
差异对比
Class names
类名
- component:
diff - part: ,
diff-item-1,diff-item-2diff-resizer
- 组件类:
diff - 子部件类:,
diff-item-1,diff-item-2diff-resizer
Syntax
语法
html
<figure class="diff">
<div class="diff-item-1">{item1}</div>
<div class="diff-item-2">{item2}</div>
<div class="diff-resizer"></div>
</figure>html
<figure class="diff">
<div class="diff-item-1">{item1}</div>
<div class="diff-item-2">{item2}</div>
<div class="diff-resizer"></div>
</figure>Rules
规则
- To maintain aspect ratio, add or other aspect ratio classes to
aspect-16/9element<figure class="diff">
- 为了保持宽高比,为 元素添加
<figure class="diff">或其他宽高比类aspect-16/9
divider
分隔线
Divider will be used to separate content vertically or horizontally
分隔线用于垂直或水平分隔内容
Class names
类名
- component:
divider - color: ,
divider-neutral,divider-primary,divider-secondary,divider-accent,divider-success,divider-warning,divider-infodivider-error - direction: ,
divider-verticaldivider-horizontal - placement: ,
divider-startdivider-end
- 组件类:
divider - 颜色类:,
divider-neutral,divider-primary,divider-secondary,divider-accent,divider-success,divider-warning,divider-infodivider-error - 方向类:,
divider-verticaldivider-horizontal - 位置类:,
divider-startdivider-end
Syntax
语法
html
<div class="divider {MODIFIER}">{text}</div>html
<div class="divider {MODIFIER}">{text}</div>Rules
规则
- {MODIFIER} is optional and can have one of each direction/color/placement class names
- Omit text for a blank divider
- {MODIFIER} 是可选的,可以使用任意一个方向/颜色/位置类名
- 省略文本即可创建空白分隔线
dock
底部导航栏
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
底部导航栏(也称为 Bottom navigation 或 Bottom bar)是为用户提供导航选项的 UI 元素,固定在屏幕底部
Class names
类名
- component:
dock - part:
dock-label - modifier:
dock-active - size: ,
dock-xs,dock-sm,dock-md,dock-lgdock-xl
- 组件类:
dock - 子部件类:
dock-label - 修饰符类:
dock-active - 尺寸类:,
dock-xs,dock-sm,dock-md,dock-lgdock-xl
Syntax
语法
html
<div class="dock {MODIFIER}">{CONTENT}</div>where content is a list of buttons:
html
<button>
<svg>{icon}</svg>
<span class="dock-label">Text</span>
</button>html
<div class="dock {MODIFIER}">{CONTENT}</div>其中内容是一系列按钮:
html
<button>
<svg>{icon}</svg>
<span class="dock-label">Text</span>
</button>Rules
规则
- {MODIFIER} is optional and can have one of the size class names
- To make a button active, add class to the button
dock-active - add is required for responsivness of the dock in iOS
<meta name="viewport" content="viewport-fit=cover">
- {MODIFIER} 是可选的,可以使用任意一个尺寸类名
- 要使按钮处于激活状态,为按钮添加 类
dock-active - 在 iOS 中,添加 是实现底部导航栏响应式的必要条件
<meta name="viewport" content="viewport-fit=cover">
drawer
抽屉
Drawer is a grid layout that can show/hide a sidebar on the left or right side of the page
抽屉是一种网格布局,可以在页面左侧或右侧显示/隐藏侧边栏
Class names
类名
- component:
drawer - part: ,
drawer-toggle,drawer-content,drawer-sidedrawer-overlay - placement:
drawer-end - modifier:
drawer-open - variant: ,
is-drawer-open:is-drawer-close:
- 组件类:
drawer - 子部件类:,
drawer-toggle,drawer-content,drawer-sidedrawer-overlay - 位置类:
drawer-end - 修饰符类:
drawer-open - 变体类:,
is-drawer-open:is-drawer-close:
Syntax
语法
html
<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:
html
<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>To open/close the drawer, use a label that points to the input:
drawer-togglehtml
<label for="my-drawer" class="btn drawer-button">Open/close drawer</label>Example: This sidebar is always visible on large screen, can be toggled on small screen:
html
<div class="drawer lg:drawer-open">
<input id="my-drawer-3" type="checkbox" class="drawer-toggle" />
<div class="drawer-content flex flex-col items-center justify-center">
<!-- Page content here -->
<label for="my-drawer-3" class="btn drawer-button lg:hidden">
Open drawer
</label>
</div>
<div class="drawer-side">
<label for="my-drawer-3" aria-label="close sidebar" class="drawer-overlay"></label>
<ul class="menu bg-base-200 min-h-full w-80 p-4">
<!-- Sidebar content here -->
<li><button>Sidebar Item 1</button></li>
<li><button>Sidebar Item 2</button></li>
</ul>
</div>
</div>Example: This sidebar is always visible. When it's close we only see iocns, when it's open we see icons and text
html
<div class="drawer lg:drawer-open">
<input id="my-drawer-4" type="checkbox" class="drawer-toggle" />
<div class="drawer-content">
<!-- Page content here -->
</div>
<div class="drawer-side is-drawer-close:overflow-visible">
<label for="my-drawer-4" aria-label="close sidebar" class="drawer-overlay"></label>
<div class="is-drawer-close:w-14 is-drawer-open:w-64 bg-base-200 flex flex-col items-start min-h-full">
<!-- Sidebar content here -->
<ul class="menu w-full grow">
<!-- list item -->
<li>
<button class="is-drawer-close:tooltip is-drawer-close:tooltip-right" data-tip="Homepage">
🏠
<span class="is-drawer-close:hidden">Homepage</span>
</button>
</li>
<!-- list item -->
<li>
<button class="is-drawer-close:tooltip is-drawer-close:tooltip-right" data-tip="Settings">
⚙️
<span class="is-drawer-close:hidden">Settings</span>
</button>
</li>
</ul>
<!-- button to open/close drawer -->
<div class="m-2 is-drawer-close:tooltip is-drawer-close:tooltip-right" data-tip="Open">
<label for="my-drawer-4" class="btn btn-ghost btn-circle drawer-button is-drawer-open:rotate-y-180">
↔️
</label>
</div>
</div>
</div>
</div>html
<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>其中 {CONTENT} 可以是导航栏、站点内容、页脚等
{SIDEBAR} 可以是如下菜单:
html
<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>要打开/关闭抽屉,使用指向 输入框的 label:
drawer-togglehtml
<label for="my-drawer" class="btn drawer-button">Open/close drawer</label>示例:侧边栏在大屏幕上始终可见,在小屏幕上可切换:
html
<div class="drawer lg:drawer-open">
<input id="my-drawer-3" type="checkbox" class="drawer-toggle" />
<div class="drawer-content flex flex-col items-center justify-center">
<!-- 页面内容 -->
<label for="my-drawer-3" class="btn drawer-button lg:hidden">
Open drawer
</label>
</div>
<div class="drawer-side">
<label for="my-drawer-3" aria-label="close sidebar" class="drawer-overlay"></label>
<ul class="menu bg-base-200 min-h-full w-80 p-4">
<!-- 侧边栏内容 -->
<li><button>Sidebar Item 1</button></li>
<li><button>Sidebar Item 2</button></li>
</ul>
</div>
</div>示例:侧边栏始终可见。关闭时仅显示图标,打开时显示图标和文本:
html
<div class="drawer lg:drawer-open">
<input id="my-drawer-4" type="checkbox" class="drawer-toggle" />
<div class="drawer-content">
<!-- 页面内容 -->
</div>
<div class="drawer-side is-drawer-close:overflow-visible">
<label for="my-drawer-4" aria-label="close sidebar" class="drawer-overlay"></label>
<div class="is-drawer-close:w-14 is-drawer-open:w-64 bg-base-200 flex flex-col items-start min-h-full">
<!-- 侧边栏内容 -->
<ul class="menu w-full grow">
<!-- 列表项 -->
<li>
<button class="is-drawer-close:tooltip is-drawer-close:tooltip-right" data-tip="Homepage">
🏠
<span class="is-drawer-close:hidden">Homepage</span>
</button>
</li>
<!-- 列表项 -->
<li>
<button class="is-drawer-close:tooltip is-drawer-close:tooltip-right" data-tip="Settings">
⚙️
<span class="is-drawer-close:hidden">Settings</span>
</button>
</li>
</ul>
<!-- 打开/关闭抽屉的按钮 -->
<div class="m-2 is-drawer-close:tooltip is-drawer-close:tooltip-right" data-tip="Open">
<label for="my-drawer-4" class="btn btn-ghost btn-circle drawer-button is-drawer-open:rotate-y-180">
↔️
</label>
</div>
</div>
</div>
</div>Rules
规则
- {MODIFIER} is optional and can have one of the modifier/placement class names
- is required for the
idinput. changedrawer-toggleto a unique id according to your needsmy-drawer - can be used to make sidebar visible on larger screens
lg:drawer-open - is a hidden checkbox. Use label with "for" attribute to toggle state
drawer-toggle - if you want to open the drawer when a button is clicked, use where
<label for="my-drawer" class="btn drawer-button">Open drawer</label>is the id of themy-drawerinputdrawer-toggle - when using drawer, every page content must be inside element. for example navbar, footer, etc should not be outside of
drawer-contentdrawer
- {MODIFIER} 是可选的,可以使用任意一个修饰符/位置类名
- 输入框需要
drawer-toggle,根据需求将id改为唯一 idmy-drawer - 使用 可使侧边栏在大屏幕上可见
lg:drawer-open - 是隐藏的复选框。使用带有 "for" 属性的 label 切换状态
drawer-toggle - 如果想点击按钮打开抽屉,使用 ,其中
<label for="my-drawer" class="btn drawer-button">Open drawer</label>是my-drawer输入框的 iddrawer-toggle - 使用抽屉时,所有页面内容必须放在 元素内。例如导航栏、页脚等不应放在
drawer-content外部drawer
dropdown
下拉菜单
Dropdown can open a menu or any other element when the button is clicked
点击按钮时,下拉菜单可以展开菜单或其他元素
Class names
类名
- component:
dropdown - part:
dropdown-content - placement: ,
dropdown-start,dropdown-center,dropdown-end,dropdown-top,dropdown-bottom,dropdown-leftdropdown-right - modifier: ,
dropdown-hover,dropdown-opendropdown-close
- 组件类:
dropdown - 子部件类:
dropdown-content - 位置类:,
dropdown-start,dropdown-center,dropdown-end,dropdown-top,dropdown-bottom,dropdown-leftdropdown-right - 修饰符类:,
dropdown-hover,dropdown-opendropdown-close
Syntax
语法
Using details and summary
html
<details class="dropdown">
<summary>Button</summary>
<ul class="dropdown-content">{CONTENT}</ul>
</details>Using popover API
html
<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
html
<div class="dropdown">
<div tabindex="0" role="button">Button</div>
<ul tabindex="-1" class="dropdown-content">{CONTENT}</ul>
</div>使用 details 和 summary:
html
<details class="dropdown">
<summary>Button</summary>
<ul class="dropdown-content">{CONTENT}</ul>
</details>使用弹出层 API:
html
<button popovertarget="{id}" style="anchor-name:--{anchor}">{button}</button>
<ul class="dropdown-content" popover id="{id}" style="position-anchor:--{anchor}">{CONTENT}</ul>使用 CSS 焦点:
html
<div class="dropdown">
<div tabindex="0" role="button">Button</div>
<ul tabindex="-1" class="dropdown-content">{CONTENT}</ul>
</div>Rules
规则
- {MODIFIER} is optional and can have one of the modifier/placement class names
- replace and
{id}with a unique name{anchor} - For CSS focus dropdowns, use and
tabindex="0"on the buttonrole="button" - The content can be any HTML element (not just )
<ul>
- {MODIFIER} 是可选的,可以使用任意一个修饰符/位置类名
- 将 和
{id}替换为唯一名称{anchor} - 对于 CSS 焦点下拉菜单,在按钮上使用 和
tabindex="0"role="button" - 内容可以是任意 HTML 元素(不只是 )
<ul>
fab
浮动操作按钮
FAB (Floating Action Button) stays in the bottom corner of screen. It includes a focusable and accessible element with button role. Clicking or focusing it shows additional buttons (known as Speed Dial buttons) in a vertical arrangement or a flower shape (quarter circle)
FAB(Floating Action Button)固定在屏幕底部角落。它包含一个可聚焦、可访问的按钮元素。点击或聚焦时,会以垂直排列或花形(四分之一圆)显示额外按钮(称为快速拨号按钮)
Class names
类名
- component:
fab - part: ,
fab-closefab-main-action - modifier:
fab-flower
- 组件类:
fab - 子部件类:,
fab-closefab-main-action - 修饰符类:
fab-flower
Syntax
语法
A single FAB in the corder of screen
html
<div class="fab">
<button class="btn btn-lg btn-circle">{IconOriginal}</button>
</div>A FAB that opens a 3 other buttons in the corner of page vertically
html
<div class="fab">
<div tabindex="0" role="button" class="btn btn-lg btn-circle btn-primary">{IconOriginal}</div>
<button class="btn btn-lg btn-circle">{Icon1}</button>
<button class="btn btn-lg btn-circle">{Icon2}</button>
<button class="btn btn-lg btn-circle">{Icon3}</button>
</div>A FAB that opens a 3 other buttons in the corner of page vertically and they have label text
html
<div class="fab">
<div tabindex="0" role="button" class="btn btn-lg btn-circle btn-primary">{IconOriginal}</div>
<div>{Label1}<button class="btn btn-lg btn-circle">{Icon1}</button></div>
<div>{Label2}<button class="btn btn-lg btn-circle">{Icon2}</button></div>
<div>{Label3}<button class="btn btn-lg btn-circle">{Icon3}</button></div>
</div>FAB with rectangle buttons. These are not circular buttons so they can have more content.
html
<div class="fab">
<div tabindex="0" role="button" class="btn btn-lg btn-circle btn-primary">{IconOriginal}</div>
<button class="btn btn-lg">{Label1}</button>
<button class="btn btn-lg">{Label2}</button>
<button class="btn btn-lg">{Label3}</button>
</div>FAB with close button. When FAB is open, the original button is replaced with a close button
html
<div class="fab">
<div tabindex="0" role="button" class="btn btn-lg btn-circle btn-primary">{IconOriginal}</div>
<div class="fab-close">Close <span class="btn btn-circle btn-lg btn-error">✕</span></div>
<div>{Label1}<button class="btn btn-lg btn-circle">{Icon1}</button></div>
<div>{Label2}<button class="btn btn-lg btn-circle">{Icon2}</button></div>
<div>{Label3}<button class="btn btn-lg btn-circle">{Icon3}</button></div>
</div>FAB with Main Action button. When FAB is open, the original button is replaced with a main action button
html
<div class="fab">
<div tabindex="0" role="button" class="btn btn-lg btn-circle btn-primary">{IconOriginal}</div>
<div class="fab-main-action">
{LabelMainAction}<button class="btn btn-circle btn-secondary btn-lg">{IconMainAction}</button>
</div>
<div>{Label1}<button class="btn btn-lg btn-circle">{Icon1}</button></div>
<div>{Label2}<button class="btn btn-lg btn-circle">{Icon2}</button></div>
<div>{Label3}<button class="btn btn-lg btn-circle">{Icon3}</button></div>
</div>FAB Flower. It opens the buttons in a flower shape (quarter circle) arrangement instead of vertical
html
<div class="fab fab-flower">
<div tabindex="0" role="button" class="btn btn-lg btn-circle btn-primary">{IconOriginal}</div>
<button class="fab-main-action btn btn-circle btn-lg">{IconMainAction}</button>
<button class="btn btn-lg btn-circle">{Icon1}</button>
<button class="btn btn-lg btn-circle">{Icon2}</button>
<button class="btn btn-lg btn-circle">{Icon3}</button>
</div>FAB Flower with tooltips. There's no space for a text label in a quarter circle, so tooltips are used to indicate the button's function
html
<div class="fab fab-flower">
<div tabindex="0" role="button" class="btn btn-lg btn-circle btn-primary">{IconOriginal}</div>
<button class="fab-main-action btn btn-circle btn-lg">{IconMainAction}</button>
<div class="tooltip tooltip-left" data-tip="{Label1}">
<button class="btn btn-lg btn-circle">{Icon1}</button>
</div>
<div class="tooltip tooltip-left" data-tip="{Label2}">
<button class="btn btn-lg btn-circle">{Icon2}</button>
</div>
<div class="tooltip tooltip-left" data-tip="{Label3}">
<button class="btn btn-lg btn-circle">{Icon3}</button>
</div>
</div>屏幕角落的单个 FAB:
html
<div class="fab">
<button class="btn btn-lg btn-circle">{IconOriginal}</button>
</div>在页面角落垂直展开 3 个其他按钮的 FAB:
html
<div class="fab">
<div tabindex="0" role="button" class="btn btn-lg btn-circle btn-primary">{IconOriginal}</div>
<button class="btn btn-lg btn-circle">{Icon1}</button>
<button class="btn btn-lg btn-circle">{Icon2}</button>
<button class="btn btn-lg btn-circle">{Icon3}</button>
</div>在页面角落垂直展开 3 个带标签文本的按钮的 FAB:
html
<div class="fab">
<div tabindex="0" role="button" class="btn btn-lg btn-circle btn-primary">{IconOriginal}</div>
<div>{Label1}<button class="btn btn-lg btn-circle">{Icon1}</button></div>
<div>{Label2}<button class="btn btn-lg btn-circle">{Icon2}</button></div>
<div>{Label3}<button class="btn btn-lg btn-circle">{Icon3}</button></div>
</div>带矩形按钮的 FAB。这些不是圆形按钮,因此可以包含更多内容:
html
<div class="fab">
<div tabindex="0" role="button" class="btn btn-lg btn-circle btn-primary">{IconOriginal}</div>
<button class="btn btn-lg">{Label1}</button>
<button class="btn btn-lg">{Label2}</button>
<button class="btn btn-lg">{Label3}</button>
</div>带关闭按钮的 FAB。打开 FAB 时,原按钮会替换为关闭按钮:
html
<div class="fab">
<div tabindex="0" role="button" class="btn btn-lg btn-circle btn-primary">{IconOriginal}</div>
<div class="fab-close">Close <span class="btn btn-circle btn-lg btn-error">✕</span></div>
<div>{Label1}<button class="btn btn-lg btn-circle">{Icon1}</button></div>
<div>{Label2}<button class="btn btn-lg btn-circle">{Icon2}</button></div>
<div>{Label3}<button class="btn btn-lg btn-circle">{Icon3}</button></div>
</div>带主操作按钮的 FAB。打开 FAB 时,原按钮会替换为主操作按钮:
html
<div class="fab">
<div tabindex="0" role="button" class="btn btn-lg btn-circle btn-primary">{IconOriginal}</div>
<div class="fab-main-action">
{LabelMainAction}<button class="btn btn-circle btn-secondary btn-lg">{IconMainAction}</button>
</div>
<div>{Label1}<button class="btn btn-lg btn-circle">{Icon1}</button></div>
<div>{Label2}<button class="btn btn-lg btn-circle">{Icon2}</button></div>
<div>{Label3}<button class="btn btn-lg btn-circle">{Icon3}</button></div>
</div>花形 FAB。它以花形(四分之一圆)排列展开按钮,而非垂直排列:
html
<div class="fab fab-flower">
<div tabindex="0" role="button" class="btn btn-lg btn-circle btn-primary">{IconOriginal}</div>
<button class="fab-main-action btn btn-circle btn-lg">{IconMainAction}</button>
<button class="btn btn-lg btn-circle">{Icon1}</button>
<button class="btn btn-lg btn-circle">{Icon2}</button>
<button class="btn btn-lg btn-circle">{Icon3}</button>
</div>带提示框的花形 FAB。四分之一圆中没有空间放置文本标签,因此使用提示框指示按钮功能:
html
<div class="fab fab-flower">
<div tabindex="0" role="button" class="btn btn-lg btn-circle btn-primary">{IconOriginal}</div>
<button class="fab-main-action btn btn-circle btn-lg">{IconMainAction}</button>
<div class="tooltip tooltip-left" data-tip="{Label1}">
<button class="btn btn-lg btn-circle">{Icon1}</button>
</div>
<div class="tooltip tooltip-left" data-tip="{Label2}">
<button class="btn btn-lg btn-circle">{Icon2}</button>
</div>
<div class="tooltip tooltip-left" data-tip="{Label3}">
<button class="btn btn-lg btn-circle">{Icon3}</button>
</div>
</div>Rules
规则
- {Icon*} should be replaced with the appropriate icon for each button. SVG icons are recommended
- {IconOriginal} is the icon that we see before opening the FAB
- {IconMainAction} is the icon we see after opening the FAB
- {Icon1}, {Icon2}, {Icon3} are the icons for the additional buttons
- {Label*} is the label text for each button
- {Icon*} 应替换为每个按钮的对应图标。推荐使用 SVG 图标
- {IconOriginal} 是打开 FAB 前显示的图标
- {IconMainAction} 是打开 FAB 后显示的图标
- {Icon1}, {Icon2}, {Icon3} 是额外按钮的图标
- {Label*} 是每个按钮的标签文本
fieldset
字段集
Fieldset is a container for grouping related form elements. It includes fieldset-legend as a title and label as a description
字段集用于分组相关表单元素。它包含作为标题的 fieldset-legend 和作为描述的 label
Class names
类名
- Component: ,
fieldsetlabel - Parts:
fieldset-legend
- 组件类:,
fieldsetlabel - 子部件类:
fieldset-legend
Syntax
语法
html
<fieldset class="fieldset">
<legend class="fieldset-legend">{title}</legend>
{CONTENT}
<p class="label">{description}</p>
</fieldset>html
<fieldset class="fieldset">
<legend class="fieldset-legend">{title}</legend>
{CONTENT}
<p class="label">{description}</p>
</fieldset>Rules
规则
- You can use any element as a direct child of fieldset to add form elements
- 可以使用任意元素作为 fieldset 的直接子元素来添加表单元素
file-input
文件输入框
File Input is a an input field for uploading files
文件输入框用于上传文件的输入字段
Class Names:
类名
- 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-warningfile-input-error - Size: ,
file-input-xs,file-input-sm,file-input-md,file-input-lgfile-input-xl
- 组件类:
file-input - 样式类:
file-input-ghost - 颜色类:,
file-input-neutral,file-input-primary,file-input-secondary,file-input-accent,file-input-info,file-input-success,file-input-warningfile-input-error - 尺寸类:,
file-input-xs,file-input-sm,file-input-md,file-input-lgfile-input-xl
Syntax
语法
html
<input type="file" class="file-input {MODIFIER}" />html
<input type="file" class="file-input {MODIFIER}" />Rules
规则
- {MODIFIER} is optional and can have one of each style/color/size class names
- {MODIFIER} 是可选的,可以使用任意一个样式/颜色/尺寸类名
filter
筛选器
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
筛选器是一组单选按钮。选择其中一个选项会隐藏其他选项,并在所选选项旁边显示重置按钮
Class names
类名
- component:
filter - part:
filter-reset
- 组件类:
filter - 子部件类:
filter-reset
Syntax
语法
Using HTML form
html
<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
html
<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>使用 HTML 表单:
html
<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>不使用 HTML 表单:
html
<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>Rules
规则
- replace with proper value, according to the context of the filter
{NAME} - Each set of radio inputs must have unique attributes to avoid conflicts
name - Use tag when possible and only use
<form>if you can't use a HTML form for some reason<div> - Use class for the reset button
filter-reset
- 根据筛选器的上下文,将 替换为合适的值
{NAME} - 每组单选输入必须有唯一的 属性,避免冲突
name - 尽可能使用 标签,仅在无法使用 HTML 表单时使用
<form><div> - 为重置按钮使用 类
filter-reset
footer
页脚
Footer can contain logo, copyright notice, and links to other pages
页脚可以包含标志、版权声明和指向其他页面的链接
Class names
类名
- component:
footer - part:
footer-title - placement:
footer-center - direction: ,
footer-horizontalfooter-vertical
- 组件类:
footer - 子部件类:
footer-title - 位置类:
footer-center - 方向类:,
footer-horizontalfooter-vertical
Syntax
语法
html
<footer class="footer {MODIFIER}">{CONTENT}</footer>where content can contain several tags with and links inside
<nav>footer-titlehtml
<footer class="footer {MODIFIER}">{CONTENT}</footer>其中内容可以包含多个带有 和内部链接的 标签
footer-title<nav>Rules
规则
- {MODIFIER} is optional and can have one of each placement/direction class names
- try to use to make footer responsive
sm:footer-horizontal - suggestion - use for background color
base-200
- {MODIFIER} 是可选的,可以使用任意一个位置/方向类名
- 尝试使用 实现响应式页脚
sm:footer-horizontal - 建议 - 使用 作为背景色
base-200
hero
英雄区
Hero is a component for displaying a large box or image with a title and description
英雄区用于展示包含标题和描述的大容器或图片
Class names
类名
- component:
hero - part: ,
hero-contenthero-overlay
- 组件类:
hero - 子部件类:,
hero-contenthero-overlay
Syntax
语法
html
<div class="hero {MODIFIER}">{CONTENT}</div>html
<div class="hero {MODIFIER}">{CONTENT}</div>Rules
规则
- {MODIFIER} is optional
- Use for the text content
hero-content - Use inside the hero to overlay the background image with a color
hero-overlay - Content can contain a figure
- {MODIFIER} 是可选的
- 使用 放置文本内容
hero-content - 在 hero 内部使用 为背景图片添加颜色叠加
hero-overlay - 内容可以包含 figure
hover-3d
3D悬停效果
Hover 3D is a wrapper component that adds a 3D hover effect to its content. When we hover over the component, it tilts and rotates based on the mouse position, creating an interactive 3D effect.
hover-3dOnly use non-interactive content inside the wrapper. If you want to make the entire card clickable, use a link for the whole component instead of putting interactive elements like buttons or links inside it.
hover-3dhover-3d3D悬停效果是一个包装组件,可为其内容添加3D悬停效果。当鼠标悬停在组件上时,它会根据鼠标位置倾斜和旋转,创建交互式3D效果。
hover-3d仅在 包装器内使用非交互式内容。如果想让整个卡片可点击,为整个 组件使用链接,而非在内部放置按钮或链接等交互式元素。
hover-3dhover-3dClass names
类名
- component:
hover-3d
- 组件类:
hover-3d
Syntax
语法
html
<div class="hover-3d my-12 mx-2">
<figure class="max-w-100 rounded-2xl">
<img src="https://img.daisyui.com/images/stock/creditcard.webp" alt="Tailwind CSS 3D card" />
</figure>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>html
<div class="hover-3d my-12 mx-2">
<figure class="max-w-100 rounded-2xl">
<img src="https://img.daisyui.com/images/stock/creditcard.webp" alt="Tailwind CSS 3D card" />
</figure>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>Rules
规则
- hover-3d can be a or a
<div><a> - hover-3d must have exactly 9 direct children where the first child is the main content and the other 8 children are empty s for hover zones
<div> - content inside hover-3d should be non-interactive (no buttons, links, inputs, etc)
- hover-3d 可以是 或
<div><a> - hover-3d 必须有恰好9个直接子元素,其中第一个子元素是主要内容,其他8个是空 作为悬停区域
<div> - hover-3d 内部的内容应为非交互式(无按钮、链接、输入框等)
hover-gallery
悬停画廊
Hover Gallery is container of images. The first image is visible be default and when we hover it horizontally, other images show up. Hover Gallery is useful for product cards in ecommerce sites, portfoilios or in image galleries. Hover Gallery can include up to 10 images.
悬停画廊是图片容器。默认显示第一张图片,水平悬停时会显示其他图片。悬停画廊适用于电商网站的产品卡片、作品集或图片画廊。悬停画廊最多可包含10张图片。
Class names
类名
- component:
hover-gallery
- 组件类:
hover-gallery
Syntax
语法
html
<figure class="hover-gallery max-w-60">
<img src="https://img.daisyui.com/images/stock/daisyui-hat-1.webp" />
<img src="https://img.daisyui.com/images/stock/daisyui-hat-2.webp" />
<img src="https://img.daisyui.com/images/stock/daisyui-hat-3.webp" />
<img src="https://img.daisyui.com/images/stock/daisyui-hat-4.webp" />
</figure>html
<figure class="hover-gallery max-w-60">
<img src="https://img.daisyui.com/images/stock/daisyui-hat-1.webp" />
<img src="https://img.daisyui.com/images/stock/daisyui-hat-2.webp" />
<img src="https://img.daisyui.com/images/stock/daisyui-hat-3.webp" />
<img src="https://img.daisyui.com/images/stock/daisyui-hat-4.webp" />
</figure>Rules
规则
- hover-gallery can be a or a
<div><figure> - hover-gallery can include up to 10 images
- hover-gallery needs a max width otherwise if fills the container width
- images must be same dimensions for a proper alignment
- hover-gallery 可以是 或
<div><figure> - hover-gallery 最多可包含10张图片
- hover-gallery 需要设置最大宽度,否则会填充容器宽度
- 图片必须尺寸相同才能正确对齐
indicator
指示器
Indicators are used to place an element on the corner of another element
指示器用于在另一个元素的角落放置元素
Class names
类名
- component:
indicator - part:
indicator-item - placement: ,
indicator-start,indicator-center,indicator-end,indicator-top,indicator-middleindicator-bottom
- 组件类:
indicator - 子部件类:
indicator-item - 位置类:,
indicator-start,indicator-center,indicator-end,indicator-top,indicator-middleindicator-bottom
Syntax
语法
html
<div class="indicator">
<span class="indicator-item">{indicator content}</span>
<div>{main content}</div>
</div>html
<div class="indicator">
<span class="indicator-item">{indicator content}</span>
<div>{main content}</div>
</div>Rules
规则
- Add all indicator elements (with class) before the main content
indicator-item - {placement} is optional and can have one of each horizontal/vertical class names. default is
indicator-end indicator-top
- 在主要内容之前添加所有带有 类的指示器元素
indicator-item - {placement} 是可选的,可以使用任意一个水平/垂直位置类名。默认是
indicator-end indicator-top
input
文本输入框
Text Input is a simple input field
文本输入框是简单的输入字段
Class names
类名
- component:
input - style:
input-ghost - color: ,
input-neutral,input-primary,input-secondary,input-accent,input-info,input-success,input-warninginput-error - size: ,
input-xs,input-sm,input-md,input-lginput-xl
- 组件类:
input - 样式类:
input-ghost - 颜色类:,
input-neutral,input-primary,input-secondary,input-accent,input-info,input-success,input-warninginput-error - 尺寸类:,
input-xs,input-sm,input-md,input-lginput-xl
Syntax
语法
html
<input type="{type}" placeholder="Type here" class="input {MODIFIER}" />html
<input type="{type}" placeholder="Type here" class="input {MODIFIER}" />Rules
规则
- {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 class for the parent when you have more than one element inside input
input
- {MODIFIER} 是可选的,可以使用任意一个样式/颜色/尺寸类名
- 可用于任意输入字段类型(文本、密码、邮箱等)
- 当输入框内部有多个元素时,为父元素使用 类
input
join
组合容器
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
组合容器用于分组多个项目,可用于分组按钮、输入框等。组合容器为第一个和最后一个项目设置边框半径。组合容器可用于创建水平或垂直项目列表
Class names
类名
- component: ,
joinjoin-item - direction: ,
join-verticaljoin-horizontal
- 组件类:,
joinjoin-item - 方向类:,
join-verticaljoin-horizontal
Syntax
语法
html
<div class="join {MODIFIER}">{CONTENT}</div>html
<div class="join {MODIFIER}">{CONTENT}</div>Rules
规则
- {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 will be affected
join-item - Use for responsive layouts
lg:join-horizontal
- {MODIFIER} 是可选的,可以使用任意一个方向类名
- join 元素的所有直接子元素会被组合在一起
- 所有带有 的元素会受到影响
join-item - 使用 实现响应式布局
lg:join-horizontal
kbd
键盘按键
Class names
类名
- component:
kbd - size: ,
kbd-xs,kbd-sm,kbd-md,kbd-lgkbd-xl
- 组件类:
kbd - 尺寸类:,
kbd-xs,kbd-sm,kbd-md,kbd-lgkbd-xl
Syntax
语法
html
<kbd class="kbd {MODIFIER}">K</kbd>html
<kbd class="kbd {MODIFIER}">K</kbd>Rules
规则
- {MODIFIER} is optional and can have one of the size class names
- {MODIFIER} 是可选的,可以使用任意一个尺寸类名
label
标签
Label is used to provide a name or title for an input field. Label can be placed before or after the field
标签用于为输入字段提供名称或标题。标签可以放在字段之前或之后
Class names
类名
- component: ,
labelfloating-label
- 组件类:,
labelfloating-label
Syntax
语法
For regular label:
html
<label class="input">
<span class="label">{label text}</span>
<input type="text" placeholder="Type here" />
</label>For floating label:
html
<label class="floating-label">
<input type="text" placeholder="Type here" class="input" />
<span>{label text}</span>
</label>普通标签:
html
<label class="input">
<span class="label">{label text}</span>
<input type="text" placeholder="Type here" />
</label>浮动标签:
html
<label class="floating-label">
<input type="text" placeholder="Type here" class="input" />
<span>{label text}</span>
</label>Rules
规则
- The class is for styling the parent element which contains the input field and label, so the label does not have the 'input' class
input - Use for the parent of an input field and a span that floats above the input field when the field is focused
floating-label
- 类用于设置包含输入字段和标签的父元素样式,因此标签本身不使用 'input' 类
input - 使用 作为输入字段和一个 span 的父元素,当字段获得焦点时,该 span 会浮动在输入字段上方
floating-label
link
链接
Class names
类名
- component:
link - style:
link-hover - color: ,
link-neutral,link-primary,link-secondary,link-accent,link-success,link-info,link-warninglink-error
- 组件类:
link - 样式类:
link-hover - 颜色类:,
link-neutral,link-primary,link-secondary,link-accent,link-success,link-info,link-warninglink-error
Syntax
语法
html
<a class="link {MODIFIER}">Click me</a>html
<a class="link {MODIFIER}">Click me</a>Rules
规则
- {MODIFIER} is optional and can have one of the modifier class names
- {MODIFIER} 是可选的,可以使用任意一个修饰符类名
list
列表
Class Names:
类名
- Component: ,
listlist-row - Modifier: ,
list-col-wraplist-col-grow
- 组件类:,
listlist-row - 修饰符类:,
list-col-wraplist-col-grow
Syntax
语法
html
<ul class="list">
<li class="list-row">{CONTENT}</li>
</ul>html
<ul class="list">
<li class="list-row">{CONTENT}</li>
</ul>Rules
规则
- Use for each item inside the list
list-row - By default, the second child of the will fill the remaining space. You can use
list-rowon another child to make it fill the remaining space insteadlist-col-grow - Use to force an item to wrap to the next line
list-col-wrap
- 为列表中的每个项使用
list-row - 默认情况下,的第二个子元素会填充剩余空间。可以在另一个子元素上使用
list-row使其填充剩余空间list-col-grow - 使用 强制项换行
list-col-wrap
loading
加载动画
Loading shows an animation to indicate that something is loading
加载动画显示动画以指示正在加载
Class names
类名
- component:
loading - style: ,
loading-spinner,loading-dots,loading-ring,loading-ball,loading-barsloading-infinity - size: ,
loading-xs,loading-sm,loading-md,loading-lgloading-xl
- 组件类:
loading - 样式类:,
loading-spinner,loading-dots,loading-ring,loading-ball,loading-barsloading-infinity - 尺寸类:,
loading-xs,loading-sm,loading-md,loading-lgloading-xl
Syntax
语法
html
<span class="loading {MODIFIER}"></span>html
<span class="loading {MODIFIER}"></span>Rules
规则
- {MODIFIER} is optional and can have one of the style/size class names
- {MODIFIER} 是可选的,可以使用任意一个样式/尺寸类名
mask
遮罩
Class names
类名
- 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-3mask-triangle-4 - modifier: ,
mask-half-1mask-half-2
- 组件类:
mask - 样式类:,
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-3mask-triangle-4 - 修饰符类:,
mask-half-1mask-half-2
Syntax
语法
html
<img class="mask {MODIFIER}" src="{image-url}" />html
<img class="mask {MODIFIER}" src="{image-url}" />Rules
规则
- {MODIFIER} is required and can have one of the style/modifier class names
- You can change the shape of any element using class names
mask - You can set custom sizes using and
w-*h-*
- {MODIFIER} 是必填的,可以使用任意一个样式/修饰符类名
- 可以使用 类名改变任意元素的形状
mask - 可以使用 和
w-*设置自定义尺寸h-*
menu
菜单
Class names
类名
- component:
menu - part: ,
menu-title,menu-dropdownmenu-dropdown-toggle - modifier: ,
menu-disabled,menu-active,menu-focusmenu-dropdown-show - size: ,
menu-xs,menu-sm,menu-md,menu-lgmenu-xl - direction: ,
menu-verticalmenu-horizontal
- 组件类:
menu - 子部件类:,
menu-title,menu-dropdownmenu-dropdown-toggle - 修饰符类:,
menu-disabled,menu-active,menu-focusmenu-dropdown-show - 尺寸类:,
menu-xs,menu-sm,menu-md,menu-lgmenu-xl - 方向类:,
menu-verticalmenu-horizontal
Syntax
语法
Vertical menu:
html
<ul class="menu">
<li><button>Item</button></li>
</ul>Horizontal menu:
html
<ul class="menu menu-horizontal">
<li><button>Item</button></li>
</ul>垂直菜单:
html
<ul class="menu">
<li><button>Item</button></li>
</ul>水平菜单:
html
<ul class="menu menu-horizontal">
<li><button>Item</button></li>
</ul>Rules
规则
- {MODIFIER} is optional and can have one of the modifier/size/direction class names
- Use for responsive layouts
lg:menu-horizontal - Use for list item title
menu-title - Use tag to make submenus collapsible
<details> - Use and
menu-dropdownto toggle the dropdown using JSmenu-dropdown-toggle
- {MODIFIER} 是可选的,可以使用任意一个修饰符/尺寸/方向类名
- 使用 实现响应式布局
lg:menu-horizontal - 使用 作为列表项标题
menu-title - 使用 标签使子菜单可折叠
<details> - 使用 和
menu-dropdown通过 JS 切换下拉菜单menu-dropdown-toggle
mockup-browser
浏览器模拟
Browser mockup shows a box that looks like a browser window
浏览器模拟显示一个看起来像浏览器窗口的容器
Class names
类名
- component:
mockup-browser - part:
mockup-browser-toolbar
- 组件类:
mockup-browser - 子部件类:
mockup-browser-toolbar
Syntax
语法
html
<div class="mockup-browser">
<div class="mockup-browser-toolbar">
{toolbar content}
</div>
<div>{CONTENT}</div>
</div>html
<div class="mockup-browser">
<div class="mockup-browser-toolbar">
{toolbar content}
</div>
<div>{CONTENT}</div>
</div>Rules
规则
- For a default mockup, use just class name
mockup-browser - To set a URL in toolbar, add a div with class
input
- 要使用默认模拟,只需使用 类名
mockup-browser - 要在工具栏中设置 URL,添加一个带有 类的 div
input
mockup-code
代码模拟
Code mockup is used to show a block of code in a box that looks like a code editor
代码模拟用于在看起来像代码编辑器的容器中显示代码块
Class names
类名
- component:
mockup-code
- 组件类:
mockup-code
Syntax
语法
html
<div class="mockup-code">
<pre data-prefix="$"><code>npm i daisyui</code></pre>
</div>html
<div class="mockup-code">
<pre data-prefix="$"><code>npm i daisyui</code></pre>
</div>Rules
规则
- Use to show a prefix before each line
<pre data-prefix="{prefix}"> - Use tag to add code syntax highlighting (requires additional library)
<code> - To highlight a line, add background/text color
- 使用 在每行前显示前缀
<pre data-prefix="{prefix}"> - 使用 标签添加代码语法高亮(需要额外库)
<code> - 要高亮某一行,添加背景/文本颜色
mockup-phone
手机模拟
Phone mockup shows a mockup of an iPhone
手机模拟显示 iPhone 的模拟界面
Class names
类名
- component:
mockup-phone - part: ,
mockup-phone-cameramockup-phone-display
- 组件类:
mockup-phone - 子部件类:,
mockup-phone-cameramockup-phone-display
Syntax
语法
html
<div class="mockup-phone">
<div class="mockup-phone-camera"></div>
<div class="mockup-phone-display">{CONTENT}</div>
</div>html
<div class="mockup-phone">
<div class="mockup-phone-camera"></div>
<div class="mockup-phone-display">{CONTENT}</div>
</div>Rules
规则
- Inside you can add anything
mockup-phone-display
- 在 内部可以添加任意内容
mockup-phone-display
mockup-window
窗口模拟
Window mockup shows a box that looks like an operating system window
窗口模拟显示一个看起来像操作系统窗口的容器
Class names
类名
- component:
mockup-window
- 组件类:
mockup-window
Syntax
语法
html
<div class="mockup-window">
<div>{CONTENT}</div>
</div>html
<div class="mockup-window">
<div>{CONTENT}</div>
</div>modal
模态框
Modal is used to show a dialog or a box when you click a button
模态框用于点击按钮时显示对话框或容器
Class names
类名
- component:
modal - part: ,
modal-box,modal-action,modal-backdropmodal-toggle - modifier:
modal-open - placement: ,
modal-top,modal-middle,modal-bottom,modal-startmodal-end
- 组件类:
modal - 子部件类:,
modal-box,modal-action,modal-backdropmodal-toggle - 修饰符类:
modal-open - 位置类:,
modal-top,modal-middle,modal-bottom,modal-startmodal-end
Syntax
语法
Using HTML dialog element
html
<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)
html
<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)
html
<a href="#my-modal" class="btn">Open modal</a>
<div class="modal" id="my-modal">
<div class="modal-box">{CONTENT}</div>
</div>使用 HTML dialog 元素:
html
<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>使用复选框(旧版):
html
<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>使用锚链接(旧版):
html
<a href="#my-modal" class="btn">Open modal</a>
<div class="modal" id="my-modal">
<div class="modal-box">{CONTENT}</div>
</div>Rules
规则
- {MODIFIER} is optional and can have one of the modifier/placement class names
- Add to make modal focusable
tabindex="0" - Use unique IDs for each modal
- For HTML dialog element modals, add for closing the modal with submit
<form method="dialog">
- {MODIFIER} 是可选的,可以使用任意一个修饰符/位置类名
- 添加 使模态框可聚焦
tabindex="0" - 为每个模态框使用唯一 ID
- 对于 HTML dialog 元素模态框,添加 用于提交关闭模态框
<form method="dialog">
navbar
导航栏
Navbar is used to show a navigation bar on the top of the page
导航栏用于在页面顶部显示导航栏
Class names
类名
- component:
navbar - part: ,
navbar-start,navbar-centernavbar-end
- 组件类:
navbar - 子部件类:,
navbar-start,navbar-centernavbar-end
Syntax
语法
html
<div class="navbar">{CONTENT}</div>html
<div class="navbar">{CONTENT}</div>Rules
规则
- use ,
navbar-start,navbar-centerto position content horizontallynavbar-end - put anything inside each section
- suggestion - use for background color
base-200
- 使用 ,
navbar-start,navbar-center水平定位内容navbar-end - 在每个区域内放置任意内容
- 建议 - 使用 作为背景色
base-200
pagination
分页
Pagination is a group of buttons
分页是一组按钮
Class names
类名
- component:
join - part:
join-item - direction: ,
join-verticaljoin-horizontal
- 组件类:
join - 子部件类:
join-item - 方向类:,
join-verticaljoin-horizontal
Syntax
语法
html
<div class="join">{CONTENT}</div>html
<div class="join">{CONTENT}</div>Rules
规则
- Use for each button or link inside the pagination
join-item - Use class for styling pagination items
btn
- 为分页内的每个按钮或链接使用
join-item - 使用 类设置分页项样式
btn
progress
进度条
Progress bar can be used to show the progress of a task or to show the passing of time
进度条用于显示任务进度或时间流逝
Class names
类名
- component:
progress - color: ,
progress-neutral,progress-primary,progress-secondary,progress-accent,progress-info,progress-success,progress-warningprogress-error
- 组件类:
progress - 颜色类:,
progress-neutral,progress-primary,progress-secondary,progress-accent,progress-info,progress-success,progress-warningprogress-error
Syntax
语法
html
<progress class="progress {MODIFIER}" value="50" max="100"></progress>html
<progress class="progress {MODIFIER}" value="50" max="100"></progress>Rules
规则
- {MODIFIER} is optional and can have one of the color class names
- You must specify value and max attributes
- {MODIFIER} 是可选的,可以使用任意一个颜色类名
- 必须指定 value 和 max 属性
radial-progress
环形进度条
Radial progress can be used to show the progress of a task or to show the passing of time
环形进度条用于显示任务进度或时间流逝
Class names
类名
- component:
radial-progress
- 组件类:
radial-progress
Syntax
语法
html
<div class="radial-progress" style="--value:70;" aria-valuenow="70" role="progressbar">70%</div>html
<div class="radial-progress" style="--value:70;" aria-valuenow="70" role="progressbar">70%</div>Rules
规则
- The CSS variable and text must be a number between 0 and 100
--value - you need to add ,
aria-valuenow="{value}"so screen readers can properly read value and also show that its a progress element to themaria-valuenow={value} - Use instead of progress because browsers can't show text inside progress tag
div - Use for setting size (default 5rem) and
--sizeto set how thick the indicator is--thickness
- CSS 变量和文本必须是 0 到 100 之间的数字
--value - 需要添加 ,以便屏幕阅读器正确读取值,并识别其为进度元素
aria-valuenow="{value}" - 使用 而非 progress,因为浏览器无法在 progress 标签内显示文本
div - 使用 设置尺寸(默认 5rem),使用
--size设置指示器的粗细--thickness
radio
单选按钮
Radio buttons allow the user to select one option
单选按钮允许用户选择一个选项
Class names
类名
- component:
radio - color: ,
radio-neutral,radio-primary,radio-secondary,radio-accent,radio-success,radio-warning,radio-inforadio-error - size: ,
radio-xs,radio-sm,radio-md,radio-lgradio-xl
- 组件类:
radio - 颜色类:,
radio-neutral,radio-primary,radio-secondary,radio-accent,radio-success,radio-warning,radio-inforadio-error - 尺寸类:,
radio-xs,radio-sm,radio-md,radio-lgradio-xl
Syntax
语法
html
<input type="radio" name="{name}" class="radio {MODIFIER}" />html
<input type="radio" name="{name}" class="radio {MODIFIER}" />Rules
规则
- {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 attributes to avoid conflicts with other sets of radio inputs on the same page
name
- {MODIFIER} 是可选的,可以使用任意一个尺寸/颜色类名
- 将 {name} 替换为单选按钮组的唯一名称
- 每组单选输入应具有唯一的 属性,避免与页面上其他单选输入组冲突
name
range
范围滑块
Range slider is used to select a value by sliding a handle
范围滑块用于通过滑动手柄选择值
Class names
类名
- component:
range - color: ,
range-neutral,range-primary,range-secondary,range-accent,range-success,range-warning,range-inforange-error - size: ,
range-xs,range-sm,range-md,range-lgrange-xl
- 组件类:
range - 颜色类:,
range-neutral,range-primary,range-secondary,range-accent,range-success,range-warning,range-inforange-error - 尺寸类:,
range-xs,range-sm,range-md,range-lgrange-xl
Syntax
语法
html
<input type="range" min="0" max="100" value="40" class="range {MODIFIER}" />html
<input type="range" min="0" max="100" value="40" class="range {MODIFIER}" />Rules
规则
- {MODIFIER} is optional and can have one of each color/size class names
- You must specify and
minattributesmax
- {MODIFIER} 是可选的,可以使用任意一个颜色/尺寸类名
- 必须指定 和
min属性max
rating
评分
Rating is a set of radio buttons that allow the user to rate something
评分是一组单选按钮,允许用户对事物进行评分
Class names
类名
- component:
rating - modifier: ,
rating-halfrating-hidden - size: ,
rating-xs,rating-sm,rating-md,rating-lgrating-xl
- 组件类:
rating - 修饰符类:,
rating-halfrating-hidden - 尺寸类:,
rating-xs,rating-sm,rating-md,rating-lgrating-xl
Syntax
语法
html
<div class="rating {MODIFIER}">
<input type="radio" name="rating-1" class="mask mask-star" />
</div>html
<div class="rating {MODIFIER}">
<input type="radio" name="rating-1" class="mask mask-star" />
</div>Rules
规则
- {MODIFIER} is optional and can have one of the modifier/size class names
- Each set of rating inputs should have unique attributes to avoid conflicts with other ratings on the same page
name - Add for the first radio to make it hidden so user can clear the rating
rating-hidden
- {MODIFIER} 是可选的,可以使用任意一个修饰符/尺寸类名
- 每组评分输入应具有唯一的 属性,避免与页面上其他评分冲突
name - 为第一个单选按钮添加 使其隐藏,以便用户清除评分
rating-hidden
select
选择框
Select is used to pick a value from a list of options
选择框用于从选项列表中选择值
Class names
类名
- component:
select - style:
select-ghost - color: ,
select-neutral,select-primary,select-secondary,select-accent,select-info,select-success,select-warningselect-error - size: ,
select-xs,select-sm,select-md,select-lgselect-xl
- 组件类:
select - 样式类:
select-ghost - 颜色类:,
select-neutral,select-primary,select-secondary,select-accent,select-info,select-success,select-warningselect-error - 尺寸类:,
select-xs,select-sm,select-md,select-lgselect-xl
Syntax
语法
html
<select class="select {MODIFIER}">
<option>Option</option>
</select>html
<select class="select {MODIFIER}">
<option>Option</option>
</select>Rules
规则
- {MODIFIER} is optional and can have one of each style/color/size class names
- {MODIFIER} 是可选的,可以使用任意一个样式/颜色/尺寸类名
skeleton
骨架屏
Skeleton is a component that can be used to show a loading state
骨架屏用于显示加载状态
Class names
类名
- component:
skeleton - modifier:
skeleton-text
- 组件类:
skeleton - 修饰符类:
skeleton-text
Syntax
语法
html
<div class="skeleton"></div>Example with text skeleton:
html
<div class="skeleton skeleton-text">Loading data...</div>html
<div class="skeleton"></div>文本骨架屏示例:
html
<div class="skeleton skeleton-text">Loading data...</div>Rules
规则
- Add and
h-*utility classes to set height and widthw-*
- 添加 和
h-*工具类设置高度和宽度w-*
stack
堆叠容器
Stack visually puts elements on top of each other
堆叠容器将元素视觉上堆叠在一起
Class Names:
类名
- Component:
stack - Modifier: ,
stack-top,stack-bottom,stack-startstack-end
- 组件类:
stack - 修饰符类:,
stack-top,stack-bottom,stack-startstack-end
Syntax
语法
html
<div class="stack {MODIFIER}">{CONTENT}</div>html
<div class="stack {MODIFIER}">{CONTENT}</div>Rules
规则
- {MODIFIER} is optional and can have one of the modifier class names
- You can use and
w-*classes to set the width and height of the stack, making all items the same sizeh-*
- {MODIFIER} 是可选的,可以使用任意一个修饰符类名
- 可以使用 和
w-*类设置堆叠容器的宽度和高度,使所有项尺寸相同h-*
stat
统计卡片
Class names
类名
- Component:
stats - Part: ,
stat,stat-title,stat-value,stat-desc,stat-figurestat-actions - Direction: ,
stats-horizontalstats-vertical
- 组件类:
stats - 子部件类:,
stat,stat-title,stat-value,stat-desc,stat-figurestat-actions - 方向类:,
stats-horizontalstats-vertical
Syntax
语法
html
<div class="stats {MODIFIER}">
<div class="stat">{CONTENT}</div>
</div>html
<div class="stats {MODIFIER}">
<div class="stat">{CONTENT}</div>
</div>Rules
规则
- {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 class
stats-vertical - Content includes ,
stat-title,stat-valueinside astat-descstat
- {MODIFIER} 是可选的,可以使用任意一个方向类名
- 默认是水平布局,但可以使用 类改为垂直布局
stats-vertical - 内容包含 内部的
stat,stat-title,stat-valuestat-desc
status
状态指示器
Status is a really small icon to visually show the current status of an element, like online, offline, error, etc
状态指示器是非常小的图标,用于直观显示元素的当前状态,如在线、离线、错误等
Class Names:
类名
- Component:
status - Color: ,
status-neutral,status-primary,status-secondary,status-accent,status-info,status-success,status-warningstatus-error - Size: ,
status-xs,status-sm,status-md,status-lgstatus-xl
- 组件类:
status - 颜色类:,
status-neutral,status-primary,status-secondary,status-accent,status-info,status-success,status-warningstatus-error - 尺寸类:,
status-xs,status-sm,status-md,status-lgstatus-xl
Syntax
语法
html
<span class="status {MODIFIER}"></span>html
<span class="status {MODIFIER}"></span>Rules
规则
- {MODIFIER} is optional and can have one of the color/size class names
- This component does not render anything visible
- {MODIFIER} 是可选的,可以使用任意一个颜色/尺寸类名
- 该组件本身不渲染可见内容
steps
步骤条
Steps can be used to show a list of steps in a process
步骤条用于显示流程中的步骤列表
Class Names:
类名
- Component:
steps - Part: ,
stepstep-icon - Color: ,
step-neutral,step-primary,step-secondary,step-accent,step-info,step-success,step-warningstep-error - Direction: ,
steps-verticalsteps-horizontal
- 组件类:
steps - 子部件类:,
stepstep-icon - 颜色类:,
step-neutral,step-primary,step-secondary,step-accent,step-info,step-success,step-warningstep-error - 方向类:,
steps-verticalsteps-horizontal
Syntax
语法
html
<ul class="steps {MODIFIER}">
<li class="step">{step content}</li>
</ul>html
<ul class="steps {MODIFIER}">
<li class="step">{step content}</li>
</ul>Rules
规则
- {MODIFIER} is optional and can have one of each direction/color class names
- To make a step active, add the class
step-primary - You can add an icon in each step using class
step-icon - To display data in ,use
data-contentat thedata-content="{value}"<li>
- {MODIFIER} 是可选的,可以使用任意一个方向/颜色类名
- 要使步骤处于激活状态,添加 类
step-primary - 可以使用 类在每个步骤中添加图标
step-icon - 要在 中显示数据,在
data-content上使用<li>data-content="{value}"
swap
切换器
Swap allows you to toggle the visibility of two elements using a checkbox or a class name
切换器允许使用复选框或类名切换两个元素的可见性
Class Names:
类名
- Component:
swap - Part: ,
swap-on,swap-offswap-indeterminate - Modifier:
swap-active - Style: ,
swap-rotateswap-flip
- 组件类:
swap - 子部件类:,
swap-on,swap-offswap-indeterminate - 修饰符类:
swap-active - 样式类:,
swap-rotateswap-flip
Syntax
语法
Using checkbox
html
<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
html
<div class="swap {MODIFIER}">
<div class="swap-on">{content when active}</div>
<div class="swap-off">{content when inactive}</div>
</div>使用复选框:
html
<label class="swap {MODIFIER}">
<input type="checkbox" />
<div class="swap-on">{content when active}</div>
<div class="swap-off">{content when inactive}</div>
</label>使用类名:
html
<div class="swap {MODIFIER}">
<div class="swap-on">{content when active}</div>
<div class="swap-off">{content when inactive}</div>
</div>Rules
规则
- {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 class using JS to control state
swap-active - To show something when the checkbox is indeterminate, use class
swap-indeterminate
- {MODIFIER} 是可选的,可以使用任意一个修饰符/样式类名
- 使用隐藏复选框控制切换状态,或使用 JS 添加/移除 类控制状态
swap-active - 要在复选框处于不确定状态时显示内容,使用 类
swap-indeterminate
tab
标签页
Class Names:
类名
- Component:
tabs - Part: ,
tabtab-content - Style: ,
tabs-box,tabs-bordertabs-lift - Modifier: ,
tab-activetab-disabled - Placement: ,
tabs-toptabs-bottom
- 组件类:
tabs - 子部件类:,
tabtab-content - 样式类:,
tabs-box,tabs-bordertabs-lift - 修饰符类:,
tab-activetab-disabled - 位置类:,
tabs-toptabs-bottom
Syntax
语法
Using buttons:
html
<div role="tablist" class="tabs {MODIFIER}">
<button role="tab" class="tab">Tab</button>
</div>Using radio inputs:
html
<div role="tablist" class="tabs tabs-box">
<input type="radio" name="my_tabs" class="tab" aria-label="Tab" />
</div>使用按钮:
html
<div role="tablist" class="tabs {MODIFIER}">
<button role="tab" class="tab">Tab</button>
</div>使用单选输入:
html
<div role="tablist" class="tabs tabs-box">
<input type="radio" name="my_tabs" class="tab" aria-label="Tab" />
</div>Rules
规则
- {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
- {MODIFIER} 是可选的,可以使用任意一个样式/尺寸类名
- 需要单选输入才能使标签内容与标签点击联动
- 如果标签页设置了背景,内部的每个标签顶部两个角都会变成圆角
table
表格
Table can be used to show a list of data in a table format
表格用于以表格格式显示数据列表
Class Names:
类名
- Component:
table - Modifier: ,
table-zebra,table-pin-rowstable-pin-cols - Size: ,
table-xs,table-sm,table-md,table-lgtable-xl
- 组件类:
table - 修饰符类:,
table-zebra,table-pin-rowstable-pin-cols - 尺寸类:,
table-xs,table-sm,table-md,table-lgtable-xl
Syntax
语法
html
<div class="overflow-x-auto">
<table class="table {MODIFIER}">
<thead>
<tr>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<th></th>
</tr>
</tbody>
</table>
</div>html
<div class="overflow-x-auto">
<table class="table {MODIFIER}">
<thead>
<tr>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<th></th>
</tr>
</tbody>
</table>
</div>Rules
规则
- {MODIFIER} is optional and can have one of each modifier/size class names
- The class is added to the wrapper div to make the table horizontally scrollable on smaller screens
overflow-x-auto
- {MODIFIER} 是可选的,可以使用任意一个修饰符/尺寸类名
- 为包装 div 添加 类,使表格在小屏幕上可水平滚动
overflow-x-auto
text-rotate
文本轮播
Text Rotate can show up to 6 lines of text, one at a time, with a an infinite loop animation. Duration is 10 seconds by default. The animation will pause on hover.
文本轮播最多可显示6行文本,每次显示一行,无限循环动画。默认持续时间为10秒。悬停时动画会暂停。
Class Names:
类名
- Component:
text-rotate
- 组件类:
text-rotate
Syntax
语法
html
<span class="text-rotate">
<span>
<span>Word 1</span>
<span>Word 2</span>
<span>Word 3</span>
<span>Word 4</span>
<span>Word 5</span>
<span>Word 6</span>
</span>
</span>Example:
Big font size, horizontally centered
html
<span class="text-rotate max-md:text-3xl text-7xl font-title">
<span class="justify-items-center">
<span>DESIGN</span>
<span>DEVELOP</span>
<span>DEPLOY</span>
<span>SCALE</span>
<span>MAINTAIN</span>
<span>REPEAT</span>
</span>
</span>Rotating words in a sentence, different colors for each word
html
<span>
Providing AI Agents for
<span class="text-rotate">
<span>
<span class="bg-teal-400 text-teal-800 px-2">Designers</span>
<span class="bg-red-400 text-red-800 px-2">Developers</span>
<span class="bg-blue-400 text-blue-800 px-2">Managers</span>
</span>
</span>
</span>Custom line height in case you have a tall font or need more vertical spacing between lines
html
<span class="text-rotate max-md:text-3xl text-7xl font-title leading-[2]">
<span class="justify-items-center">
<span>📐 DESIGN</span>
<span>⌨️ DEVELOP</span>
<span>🌎 DEPLOY</span>
<span>🌱 SCALE</span>
<span>🔧 MAINTAIN</span>
<span>♻️ REPEAT</span>
</span>
</span>html
<span class="text-rotate">
<span>
<span>Word 1</span>
<span>Word 2</span>
<span>Word 3</span>
<span>Word 4</span>
<span>Word 5</span>
<span>Word 6</span>
</span>
</span>示例:
大字体,水平居中
html
<span class="text-rotate max-md:text-3xl text-7xl font-title">
<span class="justify-items-center">
<span>DESIGN</span>
<span>DEVELOP</span>
<span>DEPLOY</span>
<span>SCALE</span>
<span>MAINTAIN</span>
<span>REPEAT</span>
</span>
</span>句子中轮播的单词,每个单词颜色不同
html
<span>
Providing AI Agents for
<span class="text-rotate">
<span>
<span class="bg-teal-400 text-teal-800 px-2">Designers</span>
<span class="bg-red-400 text-red-800 px-2">Developers</span>
<span class="bg-blue-400 text-blue-800 px-2">Managers</span>
</span>
</span>
</span>自定义行高,适用于高字体或需要更多垂直间距的情况
html
<span class="text-rotate max-md:text-3xl text-7xl font-title leading-[2]">
<span class="justify-items-center">
<span>📐 DESIGN</span>
<span>⌨️ DEVELOP</span>
<span>🌎 DEPLOY</span>
<span>🌱 SCALE</span>
<span>🔧 MAINTAIN</span>
<span>♻️ REPEAT</span>
</span>
</span>Rules
规则
- must have one span or div inside it that contains 2 to 6 spans/divs for each line of text
text-rotate - Total duration of the loop is 10000 milliseconds by default
- You can set custom duration using utility class, where value is in milliseconds (e.g.
duration-{value}for 12 seconds)duration-12000
- 内部必须有一个 span 或 div,其中包含2到6个 span/div 作为每行文本
text-rotate - 默认循环总时长为10000毫秒
- 可以使用 工具类设置自定义时长,其中 value 以毫秒为单位(例如
duration-{value}表示12秒)duration-12000
textarea
文本域
Textarea allows users to enter text in multiple lines
文本域允许用户输入多行文本
Class Names:
类名
- Component:
textarea - Style:
textarea-ghost - Color: ,
textarea-neutral,textarea-primary,textarea-secondary,textarea-accent,textarea-info,textarea-success,textarea-warningtextarea-error - Size: ,
textarea-xs,textarea-sm,textarea-md,textarea-lgtextarea-xl
- 组件类:
textarea - 样式类:
textarea-ghost - 颜色类:,
textarea-neutral,textarea-primary,textarea-secondary,textarea-accent,textarea-info,textarea-success,textarea-warningtextarea-error - 尺寸类:,
textarea-xs,textarea-sm,textarea-md,textarea-lgtextarea-xl
Syntax
语法
html
<textarea class="textarea {MODIFIER}" placeholder="Bio"></textarea>html
<textarea class="textarea {MODIFIER}" placeholder="Bio"></textarea>Rules
规则
- {MODIFIER} is optional and can have one of each style/color/size class names
- {MODIFIER} 是可选的,可以使用任意一个样式/颜色/尺寸类名
theme-controller
主题控制器
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
如果页面中存在带有 theme-controller 类的已勾选复选框或已勾选单选框,页面将使用该输入框值对应的主题
Class names
类名
- component:
theme-controller
- 组件类:
theme-controller
Syntax
语法
html
<input type="checkbox" value="{theme-name}" class="theme-controller" />html
<input type="checkbox" value="{theme-name}" class="theme-controller" />Rules
规则
- The value attribute of the input element should be a valid daisyUI theme name
- 输入元素的 value 属性应为有效的 daisyUI 主题名称
timeline
时间线
Timeline component shows a list of events in chronological order
时间线组件按时间顺序显示事件列表
Class Names:
类名
- Component:
timeline - Part: ,
timeline-start,timeline-middletimeline-end - Modifier: ,
timeline-snap-icon,timeline-boxtimeline-compact - Direction: ,
timeline-verticaltimeline-horizontal
- 组件类:
timeline - 子部件类:,
timeline-start,timeline-middletimeline-end - 修饰符类:,
timeline-snap-icon,timeline-boxtimeline-compact - 方向类:,
timeline-verticaltimeline-horizontal
Syntax
语法
html
<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>html
<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>Rules
规则
- {MODIFIER} is optional and can have one of the modifier/direction class names
- To make a vertical timeline, add the class to the
timeline-verticalelement or just do nothing (because its the default style.)ul - Add to snap the icon to the start instead of middle
timeline-snap-icon - Add the class to force all items on one side
timeline-compact
- {MODIFIER} 是可选的,可以使用任意一个修饰符/方向类名
- 要创建垂直时间线,为 元素添加
ul类,或不做任何操作(因为这是默认样式)timeline-vertical - 添加 将图标对齐到起始位置而非中间
timeline-snap-icon - 添加 类强制所有项显示在一侧
timeline-compact
toast
提示框容器
Toast is a wrapper to stack elements, positioned on the corner of page
提示框容器用于堆叠元素,固定在页面角落
Class Names:
类名
- Component:
toast - Placement: ,
toast-start,toast-center,toast-end,toast-top,toast-middletoast-bottom
- 组件类:
toast - 位置类:,
toast-start,toast-center,toast-end,toast-top,toast-middletoast-bottom
Syntax
语法
html
<div class="toast {MODIFIER}">{CONTENT}</div>html
<div class="toast {MODIFIER}">{CONTENT}</div>Rules
规则
- {MODIFIER} is optional and can have one of the placement class names
- {MODIFIER} 是可选的,可以使用任意一个位置类名
toggle
开关
Toggle is a checkbox that is styled to look like a switch button
开关是样式化为切换按钮的复选框
Class Names:
类名
- Component:
toggle - Color: ,
toggle-primary,toggle-secondary,toggle-accent,toggle-neutral,toggle-success,toggle-warning,toggle-infotoggle-error - Size: ,
toggle-xs,toggle-sm,toggle-md,toggle-lgtoggle-xl
- 组件类:
toggle - 颜色类:,
toggle-primary,toggle-secondary,toggle-accent,toggle-neutral,toggle-success,toggle-warning,toggle-infotoggle-error - 尺寸类:,
toggle-xs,toggle-sm,toggle-md,toggle-lgtoggle-xl
Syntax
语法
html
<input type="checkbox" class="toggle {MODIFIER}" />html
<input type="checkbox" class="toggle {MODIFIER}" />Rules
规则
- {MODIFIER} is optional and can have one of each color/size class names
- {MODIFIER} 是可选的,可以使用任意一个颜色/尺寸类名
tooltip
工具提示
Tooltip can be used to show a message when hovering over an element
工具提示用于悬停元素时显示消息
Class names
类名
- component:
tooltip - part:
tooltip-content - modifier:
tooltip-open - placement: ,
tooltip-top,tooltip-bottom,tooltip-lefttooltip-right - color: ,
tooltip-primary,tooltip-secondary,tooltip-accent,tooltip-info,tooltip-success,tooltip-warningtooltip-error
- 组件类:
tooltip - 子部件类:
tooltip-content - 修饰符类:
tooltip-open - 位置类:,
tooltip-top,tooltip-bottom,tooltip-lefttooltip-right - 颜色类:,
tooltip-primary,tooltip-secondary,tooltip-accent,tooltip-info,tooltip-success,tooltip-warningtooltip-error
Syntax
语法
html
<div class="tooltip {MODIFIER}" data-tip="Tooltip text">
<button class="btn">Hover me</button>
</div>html
<div class="tooltip {MODIFIER}" data-tip="Tooltip text">
<button class="btn">Hover me</button>
</div>Rules
规则
- {MODIFIER} is optional and can have one of each modifier/placement/color class names
- {MODIFIER} 是可选的,可以使用任意一个修饰符/位置/颜色类名
validator
验证器
Validator class changes the color of form elements to error or success based on input's validation rules
验证器类根据输入的验证规则将表单元素颜色更改为错误或成功色
Class names
类名
- component:
validator - part:
validator-hint
- 组件类:
validator - 子部件类:
validator-hint
Syntax
语法
html
<input type="{type}" class="input validator" required />
<p class="validator-hint">Error message</p>html
<input type="{type}" class="input validator" required />
<p class="validator-hint">Error message</p>Rules
规则
- Use with ,
input,selecttextarea
- 与 ,
input,select配合使用textarea