# 对话框 · JGuang UI

> 在当前页面上方聚焦呈现内容和操作。

- 页面: https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/dialog
- 改编自: shadcn/ui 文档 (MIT) @ bc0705384b51252af26dcc65425b216bf5eb063c
- 说明：正文保留英文原文。

> 示例 `dialog-demo`: 交互预览见 https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/dialog


## Installation


  

**Command**


  

**Manual**


```text
Use the JGuang UI Registry URL provided on /systems/jguang-ui#install.
```


### Install the following dependencies:


```bash
npm install radix-ui
```


### Copy and paste the following code into your project.


[View complete source: components/ui/dialog.tsx](/r/jguang-ui/radix/dialog.json)


### Update the import paths to match your project setup.


## Usage

```tsx showLineNumbers
import {
  Dialog,
  DialogContent,
  DialogDescription,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from "@/components/ui/dialog"
```

```tsx showLineNumbers
<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`:

```text
Dialog
├── DialogTrigger
└── DialogContent
    ├── DialogHeader
    │   ├── DialogTitle
    │   └── DialogDescription
    └── DialogFooter
```

## Custom Close Button

Replace the default close control with your own button.


> 示例 `dialog-close-button`: 交互预览见 https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/dialog


## No Close Button

Use `showCloseButton={false}` to hide the close button.


> 示例 `dialog-no-close-button`: 交互预览见 https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/dialog


## Sticky Footer

Keep actions visible while the content scrolls.


> 示例 `dialog-sticky-footer`: 交互预览见 https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/dialog


## Scrollable Content

Long content can scroll while the header stays in view.


> 示例 `dialog-scrollable-content`: 交互预览见 https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/dialog


## RTL

To enable RTL support in JGuang UI, see the [RTL configuration guide](/systems/jguang-ui/docs/rtl).


> 示例 `dialog-rtl`: 交互预览见 https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/dialog


## API Reference

See the [Radix UI](https://www.radix-ui.com/docs/primitives/components/dialog#api-reference) documentation for more information.

---

JGuang 全部资源索引: https://jiguang132.com/llms.txt
