Modal dialog for short tasks and confirmations (<.modal>).
<.button phx-click={LedgerUI.open("export")}>Export</.button>
<.modal id="export" title="Export report" description="October 2026" icon="download" size="sm">
<p>Choose a format.</p>
<:footer>
<.button variant="ghost" phx-click={LedgerUI.close("export")}>Cancel</.button>
<.button variant="primary">Export</.button>
</:footer>
</.modal>The title is either title="Export report" or the <:title> slot (markup); the footer is <:footer>
or <:actions>; show is open under the name of Phoenix's generated modal.
It opens and closes in the browser (LedgerUI.open/close/toggle("export"), no round trip),
from the server (LedgerUI.open(socket, "export")) or from the open assign. The
LedgerUI.Overlay hook (priv/static/ledger_ui/hooks/overlay.js) keeps the focus inside, closes on
Esc and on a click on the backdrop (unless prevent_close), returns the focus to the trigger and
locks the page's scroll. on_open / on_close run however it opened or closed; as event names
they push %{"id" => id} to the LiveView (or target).
The root carries data-lu-overlay: use LedgerUI.DOM.onBeforeElUpdated (see the README) so patches
keep the browser's state.
inline renders the dialog in the page flow, always visible and without the hook: a static preview.
layout="page" is the dialog of the app templates: only while open, a dim lu-overlay and a
div.lu-modal (header, .bd, footer) laid over the closest positioned ancestor, no hook;
the page owns the state and the overlay, Esc and × push on_close. The :header slot is then
the content before the ×. With phx-submit or phx-change in the attributes the dialog itself
is a <form> (so its controls validate and submit); phx-target goes to the form.
Summary
Functions
Attributes
id(:string) (required)layout(:string) -page: the canvas-v2 dialog (lu-overlay+div.lu-modalwithheader,.bd,footer), shown only whileopenand closed byon_close(a LiveView event or%JS{}). Defaults tonil. Must be one ofnil,"", or"page".open(:boolean) - The server's state; the browser can still open and close it. Defaults tofalse.show(:boolean) - The same asopen(the name of Phoenix's generatedmodal); either one opens it. Defaults tofalse.animation(:string) - Defaults to"fade". Must be one of"fade","scale","sheet","shift-down", or"shift-up".size(:string) - Defaults to"lg". Must be one of"full","lg","md","sm","xl", or"xs".placement(:string) - Defaults to"center". Must be one of"bottom","center", or"top".origin(:string) - Defaults to"center". Must be one of"bottom","center", or"top".blur(:boolean) - Defaults tofalse.backdrop_class(:any) - Defaults tonil.prevent_close(:boolean) - Defaults tofalse.close_button(:boolean) - Defaults totrue.close_variant(:string) - Defaults to"plain". Must be one of"plain", or"chip".on_open(:any) - Defaults tonil.on_close(:any) - Defaults tonil.target(:any) - Defaults tonil.close_label(:string) - Defaults to"Close".role(:string) - Defaults to"dialog". Must be one of"dialog", or"alertdialog".description(:string) - Defaults tonil.body_class(:any) - Defaults tonil.class(:any) - Merged into the card. Defaults tonil.icon(:string) - An icon tile before the title (needstitle). Defaults tonil.icon_tone(:string) - Defaults to"neutral". Must be one of"accent","error","info","lime","neutral","success", or"warning".card_style(:string) - Inline style of the card (overrides thesizewidth). Defaults tonil.inline(:boolean) - Static preview: in the page flow, always open, no hook. Defaults tofalse.- Global attributes are accepted.
Slots
title- The dialog's title (thetitle="..."attribute, a plain string, does the same); draws the header.actions- The footer's buttons; the same as:footer.header- Accepts attributes:variant(:string)class(:any)style(:string)
footer- Accepts attributes:class(:any)style(:string)
inner_block