0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…
Native dialog patterns with forms, confirmation, and scrolling. Accessible by default with focus management.
Overview
Modal dialogs use the native HTML <dialog> element which provides built-in accessibility features: focus trapping, escape key handling, and proper ARIA semantics. No JavaScript library required.
Key features:
Native focus management and trapping
Escape key closes dialog
Built-in backdrop with ::backdrop
Form integration with method="dialog"
Return value for form submissions
Basic Modal
A simple modal with header, body content, and action buttons.
Basic modal
<buttontype="button"id="open-modal"> Open Modal</button><dialogid="basic-modal"><layout-stackdata-layout-gap="l"><header><h2>Modal Title</h2></header><p>This is a basic modal dialog.</p><footer><layout-clusterdata-layout-justify="end"data-layout-gap="m"><buttontype="button"class="secondary"id="cancel-btn"> Cancel</button><buttontype="button"id="confirm-btn"> Confirm</button></layout-cluster></footer></layout-stack></dialog><script>const modal = document.getElementById('basic-modal');document.getElementById('open-modal').onclick = () => modal.showModal();document.getElementById('cancel-btn').onclick = () => modal.close();document.getElementById('confirm-btn').onclick = () => modal.close('confirm');</script>
Confirmation Dialog
A centered confirmation dialog for destructive actions. Uses method="dialog" for form submission.
Confirmation dialog
<dialogid="confirm-modal"class="confirm-dialog"><formmethod="dialog"><layout-stackdata-layout-gap="l"><header><icon-wcname="alert-triangle"size="lg"class="warning-icon"></icon-wc><h2>Confirm Deletion</h2></header><p>Are you sure? This action cannot be undone.</p><footer><layout-clusterdata-layout-justify="center"data-layout-gap="m"><buttontype="submit"value="cancel"class="secondary">Cancel</button><buttontype="submit"value="delete"class="danger">Delete</button></layout-cluster></footer></layout-stack></form></dialog><script>const modal = document.getElementById('confirm-modal'); modal.addEventListener('close', () => {if (modal.returnValue === 'delete') {// Perform delete action } });</script>
A modal containing a form with inputs. Includes a close button in the header.
Form modal
<dialogid="form-modal"><formmethod="dialog"><layout-stackdata-layout-gap="l"><headerdata-layout="cluster"data-layout-justify="between"><h2>Add New Item</h2><buttontype="button"class="ghost"aria-label="Close"><icon-wcname="x"></icon-wc></button></header><layout-stackdata-layout-gap="m"><form-field><labelfor="item-name">Name</label><inputtype="text"id="item-name"name="name"required></form-field><form-field><labelfor="item-desc">Description</label><textareaid="item-desc"name="description"rows="3"></textarea></form-field></layout-stack><footer><layout-clusterdata-layout-justify="end"data-layout-gap="m"><buttontype="button"class="secondary">Cancel</button><buttontype="submit"value="save">Save</button></layout-cluster></footer></layout-stack></form></dialog>
Dialog Styles
Base styles for the dialog element. Add to your project CSS.