{#- Modal dialogs. Shared arguments (class, attrs, kwargs): see components/button.html. Needs Alpine and the vendored @alpinejs/focus plugin. dialog(id, title, description=None, open="open", close="open = false", size="md", dismissible=True, title_expr=None, title_class="", class="", attrs=None, **kwargs) A centred modal over the overlay; the {% call %} block is the body, usually ending in a dialog_footer. open is the Alpine expression that shows it and close the statement that hides it, both evaluated in the enclosing x-data. title_expr, if given, is an Alpine expression that replaces the title text (x-text) for dialogs whose title changes. title_class is appended to the title (for example "sr-only" for a dialog, such as the command palette, whose input makes the title redundant while an accessible name is still required). size: sm (24rem) | md (28rem) | lg (32rem). dismissible adds a close button in the corner. The panel has role="dialog", aria-modal="true" and aria-labelledby (and aria-describedby with a description). While open, focus is trapped inside (x-trap), the page behind is inert and does not scroll, Esc and a click on the overlay run close, and focus returns to where it was on close. Initial focus goes to the element with autofocus, else the first focusable one: put autofocus on the safe button. class, attrs and kwargs go on the panel. dialog_footer(class="") The button row at the bottom of a dialog: right-aligned, stacked on small screens with the first button at the bottom. Example:
{{ description }}
{%- endif %}