Side panel (<.drawer>) and its sheet parts (<.sheet_header>, <.sheet_body>, <.sheet_footer>).
<.drawer id="customer" placement="right" size="md" title="New customer" description="Who buys from you.">
<.form for={@form} id="customer-form" phx-submit="save">...</.form>
<:footer>
<.button variant="ghost" phx-click={LedgerUI.close("customer")}>Cancel</.button>
<.button type="submit" form="customer-form" variant="primary">Save</.button>
</:footer>
</.drawer>The title is either title="New customer" or the <:title> slot (markup).
A bare drawer is a sliding frame for a menu; with title, :header or :footer (or variant)
it is a sheet: header, scrolling body and fixed footer. placement="bottom" is the phone's
sheet (rounded top, grab handle). It opens and closes like LedgerUI.Components.Modal
(LedgerUI.open/close/toggle, open, on_open, on_close) through the LedgerUI.Overlay hook;
by default it does not lock the page's scroll (lock_scroll).
Keep class and panel_class free of transform, filter and contain, so a modal rendered
inside the drawer still covers the whole viewport.
layout="page" is the sheet of the app templates: it renders only while open, as a dim
lu-overlay and an aside.lu-drawer laid over the closest positioned ancestor (the app shell),
with no hook; the page owns the state. The overlay, the Esc key and the × push on_close. The
:header slot is then the content before the ×, :footer the <footer>:
<.drawer :if={@order} id="order" layout="page" open on_close="close_order">
<:header><div><h3>Pedido #2495</h3><p>Criado hoje</p></div></:header>
...body...
<:footer><.button>Imprimir</.button></:footer>
</.drawer>inline renders it in the page flow (a static preview, always open, without the hook).
Summary
Functions
Same as drawer/1 (same attributes and slots), under the name the design vitrine uses.
The scrolling body of a sheet: it takes the height the header and the footer leave.
The footer of a sheet: the buttons, aligned to the end on a tinted bar.
The header of a sheet: title and description (or :content), a back arrow, buttons and the close ×.
Functions
Attributes
id(:string) (required)open(:boolean) - Defaults tofalse.layout(:string) -page: the canvas-v2 sheet (lu-overlay+aside.lu-drawerwithheader,.bd,footer), shown only whileopenand closed byon_close(a LiveView event or%JS{}). Defaults tonil. Must be one ofnil,"", or"page".side(:string) - Defaults to"left". Must be one of"left", or"right".placement(:string) - The same asside, which it overrides when given. Defaults tonil. Must be one ofnil,"","left","right", or"bottom".size(:string) - Defaults tonil.Must be one ofnil,"","sm","md","lg","wide", or"xl".variant(:string) - Defaults tonil.Must be one ofnil,"","float", or"flush".description(:string) - Defaults tonil.close_button(:boolean) - Defaults totrue.close_label(:string) - Defaults to"Close".floating(:boolean) - A sheet that floats with margins around it, the look ofvariant="float"; makes a bare drawer a sheet. Defaults tofalse.overlay(:boolean) - Defaults totrue.lock_scroll(:boolean) - Defaults tofalse.prevent_close(:boolean) - Defaults tofalse.on_open(:any) - Defaults tonil.on_close(:any) - Defaults tonil.target(:any) - Defaults tonil.class(:any) - Merged into the sliding frame. Defaults tonil.panel_class(:any) - Defaults tonil.body_class(:any) - Defaults tonil.inline(:boolean) - Static preview: in the page flow, always open, no hook. Defaults tofalse.- Global attributes are accepted.
Slots
actionsbacktitle- The sheet's title (thetitle="..."attribute, a plain string, does the same); draws the header.footer- Accepts attributes:class(:any)
header- Accepts attributes:class(:any)style(:string)
inner_block(required)
Same as drawer/1 (same attributes and slots), under the name the design vitrine uses.
Attributes
id(:string) (required)open(:boolean) - Defaults tofalse.layout(:string) -page: the canvas-v2 sheet (lu-overlay+aside.lu-drawerwithheader,.bd,footer), shown only whileopenand closed byon_close(a LiveView event or%JS{}). Defaults tonil. Must be one ofnil,"", or"page".side(:string) - Defaults to"left". Must be one of"left", or"right".placement(:string) - The same asside, which it overrides when given. Defaults to"bottom". Must be one ofnil,"","left","right", or"bottom".size(:string) - Defaults tonil.Must be one ofnil,"","sm","md","lg","wide", or"xl".variant(:string) - Defaults tonil.Must be one ofnil,"","float", or"flush".description(:string) - Defaults tonil.close_button(:boolean) - Defaults totrue.close_label(:string) - Defaults to"Close".floating(:boolean) - A sheet that floats with margins around it, the look ofvariant="float"; makes a bare drawer a sheet. Defaults tofalse.overlay(:boolean) - Defaults totrue.lock_scroll(:boolean) - Defaults tofalse.prevent_close(:boolean) - Defaults tofalse.on_open(:any) - Defaults tonil.on_close(:any) - Defaults tonil.target(:any) - Defaults tonil.class(:any) - Merged into the sliding frame. Defaults tonil.panel_class(:any) - Defaults tonil.body_class(:any) - Defaults tonil.inline(:boolean) - Static preview: in the page flow, always open, no hook. Defaults tofalse.- Global attributes are accepted.
Slots
actionsbacktitle- The sheet's title (thetitle="..."attribute, a plain string, does the same); draws the header.footer- Accepts attributes:class(:any)
header- Accepts attributes:class(:any)style(:string)
inner_block(required)
The scrolling body of a sheet: it takes the height the header and the footer leave.
Attributes
class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)
The header of a sheet: title and description (or :content), a back arrow, buttons and the close ×.
Attributes
id(:string) - The id of the title, for the drawer'saria-labelledby. Defaults tonil.drawer(:string) - The id of the drawer the close button closes; the closest one when not given. Defaults tonil.title(:string) - Defaults tonil.description(:string) - Defaults tonil.close_button(:boolean) - Defaults totrue.close_label(:string) - Defaults to"Close".class(:any) - Defaults tonil.style(:string) - Defaults tonil.- Global attributes are accepted.
Slots
actionsbackcontent