---
layout: layouts/component.njk
title: Alert Dialog
description: A modal dialog that interrupts the user with important content and expects a response.
toc:
- label: Usage
id: usage
children:
- label: Default
id: usage-default
- label: Jinja or Nunjucks
id: usage-jinja
---
{% from "macros/code_preview.njk" import code_preview %}
{% from "macros/code_block.njk" import code_block %}
{% from "components/dialog.njk" import dialog %}
{% lucide "info" %}
The Alert Dialog component uses the Dialog component.
{% set code %}{% set footer %}
{% endset %}
{{ dialog(
id="demo-alert-dialog",
title="Are you absolutely sure?",
description="This action cannot be undone. This will permanently delete your account and remove your data from our servers.",
trigger="Open Alert Dialog",
trigger_attrs={"class": "btn-outline"},
footer=footer,
close_button=false,
close_on_overlay_click=false
) }}{% endset %}
{{ code_preview("alert-dialog", code | prettyHtml) }}
The Alert Dialog component uses the same Alpine.js code as the Dialog component with one small difference: we set initialCloseOnOverlayClick to false to prevent the dialog from closing when the overlay is clicked.
{% set raw_code %}{% raw %}{% set footer %}
{% endset %}
{{ dialog(
id="demo-alert-dialog",
title="Are you absolutely sure?",
description="This action cannot be undone. This will permanently delete your account and remove your data from our servers.",
trigger="Open Alert Dialog",
trigger_attrs={"class": "btn-outline"},
footer=footer,
close_button=False,
close_on_overlay_click=False
) }}{% endraw %}
{% endset%}
{{ code_block(raw_code, "jinja") }}