此项目的所有重大更改都将记录在此文件中。请参阅 commit-and-tag-version 以获取提交指南。
<label>
中的 select 双 caret。 closes: #3613这是每个组件更改的详细列表。 大多数这些更改不会影响您的项目,因此如果您只想了解重大更改,请查看 daisyUI 5 发行说明
🆕 新增功能
alert-outline
、alert-dash
和 alert-soft
变体。alert-vertical
和 alert-horizontal
布局选项。🔧 变更
max-sm:alert-horizontal
或任何其他响应式断点,而不是硬编码的响应式断点。🗑️ 移除
artboard
和 phone-*
类。这些类只是设置 div 的宽度和高度。 请改用 Tailwind CSS w-*
和 h-*
类。之前 | 之后 |
---|---|
artboard phone-1 | w-[320px] h-[568px] |
artboard phone-2 | w-[375px] h-[667px] |
artboard phone-3 | w-[414px] h-[736px] |
artboard phone-4 | w-[375px] h-[812px] |
artboard phone-5 | w-[414px] h-[896px] |
artboard phone-6 | w-[320px] h-[1024px] |
之前 | 之后 |
---|---|
artboard artboard-horizontal phone-1 | w-[568px] h-[320px] |
artboard artboard-horizontal phone-2 | w-[667px] h-[375px] |
artboard artboard-horizontal phone-3 | w-[736px] h-[414px] |
artboard artboard-horizontal phone-4 | w-[812px] h-[375px] |
artboard artboard-horizontal phone-5 | w-[896px] h-[414px] |
artboard artboard-horizontal phone-6 | w-[1024px] h-[320px] |
- <div class="artboard phone-1">
+ <div class="w-[320px] h-[568px]">
需要明确的是,mockup-phone
未被移除。它只是不再需要 artboard
类。
🔧 变更
online
类重命名为 avatar-online
,offline
重命名为 avatar-offline
,placeholder
重命名为 avatar-placeholder
。- <div class="avatar online">
+ <div class="avatar avatar-online">
<div class="w-24 rounded-full">
<img src="https://img.daisyui.com/images/stock/photo-1534528741775-53994a69daeb.webp" />
</div>
</div>
- <div class="avatar offline">
+ <div class="avatar avatar-offline">
<div class="w-24 rounded-full">
<img src="https://img.daisyui.com/images/stock/photo-1534528741775-53994a69daeb.webp" />
</div>
</div>
🆕 新增功能
badge-dash
和 badge-soft
样式。badge-xl
尺寸。gap-2
,因此您不必手动添加它来在文本和图标之间放置空格。🔧 变更
🆕 新增功能
gap-2
,因此您不必手动添加它来在文本和图标之间放置空格。🗑️ 移除
bottom-nav
组件。 请改用 dock
组件。btm-nav-xs
、btm-nav-sm
、btm-nav-md
、btm-nav-lg
。 请改用 dock-xs
、dock-sm
、dock-md
、dock-lg
。btm-nav-active
。 请改用 dock-active
。bottom-nav
的 disabled
类。 如果是按钮,请使用 aria-disabled="true"
属性或 disabled
属性。 这是为了更好的可访问性。- <div class="btm-nav btm-nav-sm">
+ <div class="dock dock-sm">
<button>🏠</button>
- <button class="active">🍿</button>
+ <button class="dock-active">🍿</button>
<button>⚙️</button>
</div>
🆕 新增功能
btn-xl
尺寸。btn-dash
和 btn-soft
样式。--depth
效果,则添加了 box-shadow。🔧 变更
--size-field
自定义。checked:btn-secondary
这样的自定义btn-ghost
hover 样式已更改。 在 v4 中,btn-ghost
具有特定的 hover 样式,会覆盖任何颜色修改。 例如,在 btn btn-ghost btn-primary
中,按钮看起来不是 primary 色。 在 v5 中,btn-ghost
现在只在 hover 之前看起来像 ghost。 它在 hover 时显示原始颜色。🆕 新增功能
card-border
和 card-dash
样式,它们从主题中调整边框宽度。card-xs
、card-sm
、card-md
、card-lg
、card-xl
)。<label class="card">
作为单选卡。 如果复选框或单选按钮直接位于卡片内,则单击卡片将切换复选框/单选按钮,并在卡片周围显示轮廓。🔧 变更
card-bordered
重命名为 card-border
。- <div class="card card-bordered">
+ <div class="card card-border">
🗑️ 移除
card-compact
。 请改用 card-sm
。🆕 新增功能
chat-bubble-neutral
颜色。🔧 变更
neutral
更改为 base-300
。 如果您想继续使用 neutral 色,请添加 chat-bubble-neutral
。🆕 新增功能
checkbox-xl
尺寸。checkbox-neutral
颜色。🔧 变更
🆕 新增功能
🆕 新增功能
🔧 变更
diff-item-1
,第二张图片是 diff-item-2
。tabindex="0"
允许使用键盘导航或在 CSS resize
属性不受支持的 iOS Safari 上点击来聚焦元素。- <figure class="diff aspect-16/9">
+ <figure class="diff aspect-16/9" tabindex="0">
<div class="diff-item-1" role="img">
<img alt="image 1" src="https://img.daisyui.com/images/stock/photo-1560717789-0ac7c58ac90a.webp" />
</div>
- <div class="diff-item-2" role="img">
+ <div class="diff-item-2" role="img" tabindex="0">
<img alt="image 2" src="https://img.daisyui.com/images/stock/photo-1560717789-0ac7c58ac90a-blur.webp" />
</div>
<div class="diff-resizer"></div>
</figure>
🆕 新增功能
popover
属性的支持。 HTML popover 是在 HTML 中创建下拉菜单的新标准。 它可以防止任何溢出边缘情况问题和任何 z-index 问题。Anchor positioning
的支持(目前仅在基于 Chromium 的浏览器上有效。 其他浏览器会将下拉菜单定位在屏幕中间,就像模态框一样)。🔧 变更
@starting-style
。display
而不是 visibility
来显示/隐藏下拉菜单,以防止溢出问题。🆕 新增功能
🆕 新增功能
file-input-xl
尺寸。🔧 变更
file-input-ghost
。🗑️ 移除
file-input-bordered
。 File input 现在默认带有边框。 如果您想移除边框,请使用 file-input-ghost
。- <input type="file" class="file-input file-input-bordered">
+ <input type="file" class="file-input">
🆕 新增功能
footer-horizontal
, footer-vertical
)。🔧 变更
footer-horizontal
使其在您想要的屏幕尺寸上水平显示。- <footer class="footer">
+ <footer class="footer md:footer-horizontal">
🆕 新增功能
input-xl
尺寸。🔧 变更
w-full max-w-xs
。input-border
。Input 现在默认带有边框。 如果您想移除边框,请使用 input-ghost
。🗑️ 移除
input-bordered
类(不再需要)。<!-- Input with border -->
<input class="input input-bordered"/>
<!-- Input without border -->
<input class="input"/>
<!-- Input with 20rem width -->
<input class="input w-full max-w-xs"/>
<!-- Input with border -->
<input class="input"/>
<!-- Input without border -->
<input class="input input-ghost"/>
<!-- Input with consistent width -->
<input class="input"/>
🔧 变更
🆕 新增功能
kbd-xl
尺寸。🔧 变更
🔧 变更
loading-xl
尺寸。🗑️ 移除
mask-parallelogram
、mask-parallelogram-2
、mask-parallelogram-3
和 mask-parallelogram-4
。 这些 mask 样式不再包含在库中。 如果您需要它们,请手动使用 CSS🆕 新增功能
menu-xl
尺寸。🔧 变更
w-full
。 如果您希望它是全宽,请使用 w-full
。disabled
类重命名为 menu-disabled
。active
类重命名为 menu-active
。focus
类重命名为 menu-focus
。- <ul class="menu">
+ <ul class="menu w-full">
- <li class="disabled"><a>disabled item</a></li>
+ <li class="menu-disabled"><a>disabled item</a></li>
- <li class="active"><a>active item</a></li>
+ <li class="menu-active"><a>active item</a></li>
- <li class="focus"><a>focus item</a></li>
+ <li class="menu-focus"><a>focus item</a></li>
</ul>
🔧 变更
camera
类重命名为 mockup-phone-camera
。display
类重命名为 mockup-phone-display
。mockup-phone-display
<div class="mockup-phone">
- <div class="camera"></div>
+ <div class="mockup-phone-camera"></div>
- <div class="display">
+ <div class="mockup-phone-display">
- <div class="artboard artboard-demo phone-1">Hi.</div>
+ <div class="w-[320px] h-[568px]">Hi.</div>
</div>
</div>
🆕 新增功能
modal-start
和 modal-end
定位选项。🔧 变更
@starting-style
display
而不是 visibility
来显示/隐藏模态框。🆕 新增功能
--value
更改时添加了动画。🆕 新增功能
radio-xl
尺寸。🔧 变更
🆕 新增功能
range-xl
尺寸。🔧 变更
🆕 新增功能
🔧 变更
🆕 新增功能
select-xl
尺寸。🔧 变更
重大变更: 选择框现在默认宽度为 20rem,无需添加 w-full max-w-xs
。可以使用 max-w-none
类。
重大变更: 移除 select-border
。选择框现在默认带有边框。如果想要移除边框,请使用 select-ghost
。
调整了内边距、高度和字体大小,以与其他组件匹配。
<!-- Select with border -->
<select class="select select-bordered">
<!-- Select without border -->
<select class="select">
<!-- Select with consistent width -->
<select class="select w-full max-w-xs">
<!-- Select with border -->
<select class="select">
<!-- Select without border -->
<select class="select select-ghost">
<!-- Select with consistent width -->
<select class="select">
🆕 新增功能
stack-bottom
、stack-top
、stack-start
、stack-end
。🔧 变更
- <div class="stack">
- <div class="card bg-base-100 w-36 h-36">Text</div>
- <div class="card bg-base-100 w-36 h-36">Text</div>
- <div class="card bg-base-100 w-36 h-36">Text</div>
+ <div class="stack w-36 h-32">
+ <div class="card bg-base-100">Text</div>
+ <div class="card bg-base-100">Text</div>
+ <div class="card bg-base-100">Text</div>
</div>
🔧 变更
stats
组件的背景颜色现在是透明的。如果需要背景颜色,请使用 bg-base-100
。🆕 新增功能
step-icon
类。🆕 新增功能
tab-xl
尺寸。tabs-top
和 tabs-bottom
定位选项。🔧 变更
tabs
和 tab-content
从 grid 布局更改并重构为 flex 布局,从而修复了 tab-content
末端不稳定的 margin 问题,这个问题是 v4 版本中使用无限 grid 列将标签页推到左侧同时保持内容全宽的副作用。 flex 和 flex order 使我们能够更好地控制这种布局。tabs-lifted
重命名为 tabs-lift
。- <div class="tabs tabs-lifted">
+ <div class="tabs tabs-lift">
🆕 新增功能
table-xl
尺寸。🔧 变更
hover
类。请使用 hover:bg-base-300
(或任何其他颜色)代替。- <tr class="hover">
+ <tr class="hover:bg-base-300">
🆕 新增功能
textarea-xl
尺寸。🔧 变更
textarea-border
。文本框现在默认带有边框。如果想要移除边框,请使用 textarea-ghost
。🆕 新增功能
🆕 新增功能
toggle-xl
尺寸。toggle-neutral
颜色。🔧 变更
🆕 新增功能
tooltip-content
类,允许工具提示内部包含 HTML 内容。🔧 变更
🔧 变更
@tailwindcss/typography
插件,而不应用其他修改(如内边距)。您可以根据 @tailwindcss/typography
配置 自定义这些设置。如果您想要 v4 版本的其他修改,这是 CSS 代码您仍然可以使用相同的 HTML 结构,但类名不再存在,并且不会应用颜色、字体大小、flex 等样式。
我建议您对 fieldset
和 legend
元素使用新添加的类名,以获得更好的可访问性。
<label class="form-control w-full max-w-xs">
Login
<div class="label">
<span class="label-text">Name</span>
</div>
<input class="input" placeholder="Name" />
</label>
<fieldset class="fieldset">
<legend>Login</legend>
<label class="label" for="name">Name</label>
<input id="name" class="input" placeholder="Name" />
</fieldset>
<label class="form-control w-full max-w-xs">
<div class="label">
<span class="label-text">What is your name?</span>
<span class="label-text-alt">Top Right label</span>
</div>
<input type="text" placeholder="Type here" class="input input-bordered w-full max-w-xs" />
<div class="label">
<span class="label-text-alt">Bottom Left label</span>
<span class="label-text-alt">Bottom Right label</span>
</div>
</label>
<fieldset class="fieldset max-w-xs">
<label class="label flex justify-between" for="name">
<span>What is your name?</span>
<span>Top Right label</span>
</label>
<input id="name" class="input" placeholder="Name" />
<label class="label flex justify-between" for="name">
<span>Bottom Left label</span>
<span>Bottom Right label</span>
</label>
</fieldset>
btn-group、input-group 在一年前已被弃用,现在终于被移除。
如果您一直在使用 btn-group 或 input-group,则可以使用 join
代替
<div class="btn-group">
<button class="btn">Button 1</button>
<button class="btn">Button 2</button>
</div>
<div class="join">
<button class="btn join-item">Button 1</button>
<button class="btn join-item">Button 2</button>
</div>