Components组件Base UIBase UI 组件
对话框
在当前页面上方聚焦呈现内容和操作。
中文模式已适配导航、标题、简介、目录与常用章节名称。翻译状态:部分完成;技术正文目前仍为英文。
Loading JGuang UI example…
安装
Command
Manual
Use the JGuang UI Registry URL provided on /systems/jguang-ui#install.
安装以下依赖:
npm install @base-ui/react
将以下代码复制到你的项目中。
View complete source: components/ui/dialog.tsx
根据项目配置更新导入路径。
用法
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>
Composition
Use the following composition to build a Dialog:
Dialog
├── DialogTrigger
└── DialogContent
├── DialogHeader
│ ├── DialogTitle
│ └── DialogDescription
└── DialogFooter
Custom Close Button
Replace the default close control with your own button.
Loading JGuang UI example…
No Close Button
Use showCloseButton={false} to hide the close button.
Loading JGuang UI example…
Sticky Footer
Keep actions visible while the content scrolls.
Loading JGuang UI example…
Scrollable Content
Long content can scroll while the header stays in view.
Loading JGuang UI example…
从右到左布局
To enable RTL support in JGuang UI, see the RTL configuration guide.
Loading JGuang UI example…
API 参考
See the Base UI documentation for more information.
来源: components/base/dialog.mdx
JGuang UI 技术文档。