警报
Payment successful
New feature available
用途
Add your alert HTML
Use alert for default styling. Add data-variant="destructive" for error states. Add a direct child <footer> for an inline-end action region.
HTML 结构
<div class="alert">Main container. Use
data-variant="destructive"for error states.<svg>Optional- The icon.
<h2>- The title.
<section>Optional- The description.
<footer>Optional- The action region, aligned to the inline end of the alert. Put the action element inside it, such as a button or link.
示例
基本
带有图标、标题和描述的基本警报。
Account updated successfully
破坏性
使用 data-variant="destructive" 创建破坏性警报。
Payment failed
动作
Use <footer> to add a button or other action element to the alert.
Dark mode is now available
自定义颜色
您可以通过向警报添加自定义类(例如 bg-amber-50 dark:bg-amber-950)来自定义警报颜色。
Your subscription will expire in 3 days.
RTL
将 dir="rtl" 添加到警报或祖先。