# <dialog>

A dialog with a title, a message, and confirm and cancel buttons that run statements.

Category: Overlays.

```ham
<dialog title="Cancel this trip?"
        confirm-label="Cancel trip"
        cancel-label="Keep it">
    <text>Your booking in Lisbon will be released. This can't be undone.</text>
</dialog>
```

How Hype Apps draws it on a phone: [light](https://hypeapps.dev/img/tags/dialog-light.webp), [dark](https://hypeapps.dev/img/tags/dialog-dark.webp).

## Attributes

| Name | What it does | Default |
|---|---|---|
| `cancel-label` | Show a cancel button with this label. |  |
| `confirm-label` (also `action-label`) | The confirm button's label. | `OK` |
| `icon` | An icon above the title (icon name). |  |
| `title` | Dialog title | `Dialog` |

## Commands

| Name | What it does |
|---|---|
| `dismiss` | Close it. |
| `show` | Open it. |

## Events

| Name | What it does |
|---|---|
| `action-cancel` | Statements to run when the cancel button is pressed. |
| `action-confirm` | Statements to run when the confirm button is pressed (the dialog closes first), e.g. "#db.trip.delete:$id". @on.confirm is the same. |

## Readings

| Name | What it does |
|---|---|
| `open` | Whether it is showing. |

Any tag also takes gestures: `@on.tap`, `@on.longpress`, `@on.doubletap` and `@on.swipeleft` (and right, up and down). `@click` runs on a tap too.

## Related tags

- [`<text>`](https://hypeapps.dev/docs/reference/text.md): A run of text; with @text it shows an expression that updates as its variables change.
- [`<bottom-sheet>`](https://hypeapps.dev/docs/reference/bottom-sheet.md): A sheet that slides up from the bottom of the screen, with a drag handle and a title.
- [`<dropdown>`](https://hypeapps.dev/docs/reference/dropdown.md): A Material dropdown menu: a field that opens a list of choices; the chosen value is readable by id.
- [`<menu-item>`](https://hypeapps.dev/docs/reference/menu-item.md): One choice in a popup menu or dropdown: an icon, a label, and the action it runs.
- [`<popover>`](https://hypeapps.dev/docs/reference/popover.md): Floats its children next to another element, like a reactions bar over a Like button.
- [`<popup-menu>`](https://hypeapps.dev/docs/reference/popup-menu.md): An icon button that opens a context menu; picking an item runs its action and fires select.
- [`<snackbar>`](https://hypeapps.dev/docs/reference/snackbar.md): A short message bar pinned to the bottom of the screen, with an optional action button.

All tags: https://hypeapps.dev/docs/reference.md · The full reference: https://hypeapps.dev/llms.txt
