Modal dialog on the shared overlay runtime (focus trap, Escape/outside
dismissal, prefers-reduced-motion-aware fade).
<.modal id="confirm-delete">
<h2>Delete 3 objects?</h2>
<p>This cannot be undone.</p>
<.button phx-click={LanternUI.close_dialog("confirm-delete")}>Cancel</.button>
<.button variant="solid" color="danger" phx-click="delete">Delete</.button>
</.modal>
<.button phx-click={LanternUI.open_dialog("confirm-delete")}>Delete…</.button>The API mirrors Fluxon's modal/1; open/close from the client with
LanternUI.open_dialog/1 / close_dialog/1 (JS commands) or from the server
with LanternUI.open_dialog(socket, id) / close_dialog(socket, id).
Animation-tuning attrs (animation*) are accepted for Fluxon compatibility;
the fade duration comes from the --lantern-duration token.
Summary
Functions
Attributes
id(:string) (required)open(:boolean) - render already open (server-driven modals). Defaults tofalse.on_open(Phoenix.LiveView.JS) - Defaults tonil.on_close(Phoenix.LiveView.JS) - Defaults tonil.class(:any) - Defaults tonil.container_class(:any) - Defaults tonil.backdrop_class(:any) - Defaults tonil.close_on_esc(:boolean) - Defaults totrue.close_on_outside_click(:boolean) - Defaults totrue.prevent_closing(:boolean) - Defaults tofalse.hide_close_button(:boolean) - Defaults tofalse.placement(:string) - Defaults to"center". Must be one of"center", or"top".animation(:string) - accepted for Fluxon compat; fade is token-driven. Defaults tonil.animation_enter(:string) - accepted for Fluxon compat. Defaults tonil.animation_leave(:string) - accepted for Fluxon compat. Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)