---
## Dialog
Overlay dialog built on native dialog element. Can be used as a simple
content-agnostic overlay or as a structured dialog with title, optional header icon and
footer. `intent` tints the header markers (title, icon) and is exposed as `data-intent`
on the panel; the panel surface itself stays neutral, because a tinted surface under a
consumer's form or table would hijack that content's contrast ratios.
**Import:** `import { Dialog } from '@urbicon-ui/blocks';`
### Examples
```svelte
```
```svelte
```
### Variants
- intent: danger, neutral, primary, secondary, success, warning (default: neutral)
- size: full, fullscreen, lg, md, sm, xl (default: sm)
- placement: center, top (default: center)
- center — Mobile keeps the bottom-sheet alignment so a swipe-up gesture hits the bottom edge; desktop opens centered.
### Api
| Prop | Type | Required | Default | Description |
| --- | --- | :---: | --- | --- |
| children | `Snippet` | yes | | Dialog body content. When `title` is omitted the content fills the entire panel. |
| ...HTMLDialogAttributes | `HTMLAttributes` | no | | HTML attributes (excluding: 'children' | 'open' | 'draggable') |
| class | `string` | no | | Additional CSS classes applied to the dialog panel. In the same Tailwind bucket `class` wins over the `slotClasses` entry for the element it lands on. Presets and provider defaults sit below both. |
| closeOnBackdropClick | `boolean` | no | true | Whether clicking the backdrop dismisses the dialog. Turning this off together with `closeOnEscape` and `hideCloseButton` is a legitimate pattern for a forced choice (terms to accept, data loss to confirm, an expired session) — but only when the dialog itself renders the action that resolves it. Without one there is no way out, and DEV warns. |
| closeOnEscape | `boolean` | no | true | Whether pressing Escape dismisses the dialog. The ARIA APG recommends Escape and does not forbid disabling it; the same condition as `closeOnBackdropClick` applies — with every exit closed, the dialog must carry its own action. Escape is dismissed one layer at a time: a control INSIDE the dialog that handles Escape itself — an open `Select`/`Combobox`/`Menu` panel, an open `Popover` wherever focus sits, a `clearable` `Input` with text in it — consumes the key, and the dialog stays up. The second Escape closes the dialog. This is about controls in the content; it does not apply to a consumer `onkeydown` on the Dialog itself, which cannot veto the dismiss (see utils/compose-handlers.ts) — use this prop for that. |
| draggable | `boolean` | no | false | Let the user reposition the dialog by dragging its header. Off by default. The structured header (rendered when `title` is set) becomes the drag handle; the close button and any header controls stay clickable, and the offset resets each time the dialog reopens. Most useful for a dialog the user may want to shove aside to see the content behind it. Requires a `title` — without a header there is nothing to grab. Overrides the native HTML `draggable` attribute, which has no meaningful use on a dialog. |
| footer | `Snippet` | no | | Action buttons rendered in a footer bar. Only rendered when provided. |
| hideCloseButton | `boolean` | no | false | Hides the built-in close button. Only takes effect when `title` is also set — the close button only renders in the structured (titled) header. Without a title, no close button exists to hide. The last of the three exits; see `closeOnBackdropClick` for what closing all of them requires. |
| icon | `Snippet` | no | | Icon rendered before the title in the header bar. Takes its colour from `intent`, so a bare icon component is enough — no wrapper needed. Marked `aria-hidden`: it repeats the intent the title already carries in words. Requires `title` (no header renders without one). |
| intent | `DialogVariants['intent']` | no | 'neutral' | Semantic purpose marker (e.g. `danger` for destructive actions). Tints the header markers — the title and, when given, `icon`. The panel surface stays neutral by design: this is a container for arbitrary content, and a tinted surface would hijack the contrast ratios of the form, table or code block inside it (the Toast makes the same split). The value is additionally exposed on the panel as `data-intent="…"` for presets and CSS overrides. |
| onClose | `() => void` | no | | Fires when a close of the dialog is requested — Escape, a backdrop click, the close button, `overlayStack.closeAll()` or `closeTop()` — before the exit animation, while focus is still inside. `open` is already `false` when it runs, and writing `open = true` back synchronously inside it vetoes the close: the dialog stays open, plays no exit, keeps focus and never reaches `onClosed`. A close the browser performs itself also arrives here, after the `