# Dialog (https://www.librechat.ai/docs/development/components/dialog)

LibreChat's modal dialog is built from `OGDialog` and its parts. For a standard dialog with a title, a body and a confirm action, `OGDialogTemplate` assembles them and adds a localized Cancel button.

<ComponentPreview example="dialog/confirm" title="Confirmation dialog" minHeight={320} />

<Callout type="info">
The next release of `@librechat/client` also exports these parts under plain names (`Dialog`, `DialogContent`, `DialogTemplate` and the rest). They are the same components, so either name works once that release is out.
</Callout>

## Parts

| Part | Role |
| --- | --- |
| `OGDialog` | The root; controls whether the dialog is open. |
| `OGDialogTrigger` | The element that opens it. Use `asChild` with a `Button`. |
| `OGDialogContent` | The dialog surface, with an optional close button. |
| `OGDialogHeader`, `OGDialogTitle`, `OGDialogDescription` | The heading area. Every dialog needs a title. |
| `OGDialogFooter`, `OGDialogClose` | The action row and a control that closes the dialog. |
| `OGDialogTemplate` | A complete dialog: `title`, `main`, `selection` and an optional Cancel button. |

## Width and dismissal

Constrain a dialog to `w-11/12` plus a `max-w-*` cap so it holds up from desktop to phone, and give it exactly one clear way out: the close button or a Cancel button.

## Accessibility

Opening the dialog moves focus into it and keeps focus inside until it closes; closing returns focus to the trigger. For a destructive confirmation, `AlertDialog` gives screen readers the stronger `alertdialog` role.

| Key | Action |
| --- | --- |
| <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> | Move between the dialog's controls |
| <kbd>Escape</kbd> | Closes the dialog and returns focus to the trigger |
