组件
- 手风琴
- 警报
- 警报对话框
- 纵横比
- 头像
- 徽章
- 面包屑
- 按钮
- 按钮组
- 日历
- 卡片
- 轮播
- 图表
- 复选框
- 可折叠
- 组合框
- 命令
- 上下文菜单
- 数据表格
- 日期选择器
- 对话框
- 方向
- 抽屉
- 下拉菜单
- 空
- 字段
- 悬停卡
- 输入
- 输入组
- 输入 OTP
- 条目
- 键盘
- 标签
- 菜单栏
- 原生选择
- 导航菜单
- 分页
- 弹出窗口
- 进度
- 单选按钮组
- 可调整大小
- 滚动区域
- 选择
- 分隔符
- 工作表
- 侧边栏
- 骨架
- 滑块
- Sonner
- 旋转器
- 切换
- 表格
- 标签
- 文本区域
- Toast
- 切换
- 切换组
- 工具提示
- 排版
- 手风琴
- 警报
- 警报对话框
- 纵横比
- 头像
- 徽章
- 面包屑
- 按钮
- 按钮组
- 日历
- 卡片
- 轮播
- 图表
- 复选框
- 可折叠
- 组合框
- 命令
- 上下文菜单
- 数据表格
- 日期选择器
- 对话框
- 方向
- 抽屉
- 下拉菜单
- 空
- 字段
- 悬停卡
- 输入
- 输入组
- 输入 OTP
- 条目
- 键盘
- 标签
- 菜单栏
- 原生选择
- 导航菜单
- 分页
- 弹出窗口
- 进度
- 单选按钮组
- 可调整大小
- 滚动区域
- 选择
- 分隔符
- 工作表
- 侧边栏
- 骨架
- 滑块
- Sonner
- 旋转器
- 切换
- 表格
- 标签
- 文本区域
- Toast
- 切换
- 切换组
- 工具提示
- 排版
import { Button } from "@/components/ui/button"
import {
Dialog,安装
🌐 Installation
pnpm dlx shadcn@latest add dialog
用法
🌐 Usage
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog"<Dialog>
<DialogTrigger>Open</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Are you absolutely sure?</DialogTitle>
<DialogDescription>
This action cannot be undone. This will permanently delete your account
and remove your data from our servers.
</DialogDescription>
</DialogHeader>
</DialogContent>
</Dialog>示例
🌐 Examples
自定义关闭按钮
🌐 Custom Close Button
用你自己的按钮替换默认的关闭控件。
🌐 Replace the default close control with your own button.
import { Button } from "@/components/ui/button"
import {
Dialog,没有关闭按钮
🌐 No Close Button
使用 showCloseButton={false} 来隐藏关闭按钮。
🌐 Use showCloseButton={false} to hide the close button.
import { Button } from "@/components/ui/button"
import {
Dialog,固定底部
🌐 Sticky Footer
在内容滚动时保持操作可见。
🌐 Keep actions visible while the content scrolls.
import { Button } from "@/components/ui/button"
import {
Dialog,可滚动内容
🌐 Scrollable Content
长内容可以滚动,而标题保持可见。
🌐 Long content can scroll while the header stays in view.
import { Button } from "@/components/ui/button"
import {
Dialog,从右到左
🌐 RTL
要在 shadcn/ui 中启用 RTL 支持,请参阅 RTL 配置指南。
🌐 To enable RTL support in shadcn/ui, see the RTL configuration guide.
"use client"
import { Button } from "@/examples/base/ui-rtl/button"API参考
🌐 API Reference
有关更多信息,请参见 Base UI 文档。
🌐 See the Base UI documentation for more information.