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…
Alerts come in five semantic variants for different message types.
Alert variants
123456
<status-messagedata-variant="success"><sectiondata-content><strongdata-title>Success</strong><pdata-description>Your changes have been saved.</p></section></status-message>
With Icons
Add an icon-wc element with data-iconattribute for visual emphasis.
Alert with icon
1234567
<status-messagedata-variant="success"><icon-wcname="circle-check"data-icon></icon-wc><sectiondata-content><strongdata-title>Success</strong><pdata-description>Your changes have been saved.</p></section></status-message>
Add a <button data-dismiss> as a direct child to make the message closable. Activating it hides the message with the hiddenattribute (use data-dismiss="remove" to remove it from the DOM instead). If focus was inside the message, it moves to the element matched by data-dismiss-focus, or else to the next focusable element after the message, so keyboard users keep their place.
Before hiding, the message fires a bubbling, cancelable status-message:dismiss event. Call preventDefault() to keep the message (for example to animate it out yourself).
Alert with dismiss button
1234567
<status-messagedata-variant="info"><sectiondata-content><strongdata-title>Dismissable Alert</strong><pdata-description>Activate the X to dismiss.</p></section><buttondata-dismisstype="button"aria-label="Dismiss">✕</button></status-message>
Accessibility
Variant titles and compact text use the --color-*-text tokens, which meet WCAG AA on the subtle backgrounds; filled messages keep a visible border in forced-colours mode.
Live regions announce changes, not content that is already on the page. A message present at page load with role="status" is usually not announced, and role="alert" on page-load content is announced immediately by some screen readers and not at all by others. For messages that appear in response to an action, keep an empty role="status" (or role="alert") container in the page from the start and insert the <status-message> into it when the event happens.
Accessible alerts
123456789
<!-- For error messages --><status-messagedata-variant="error"role="alert"> ...</status-message><!-- For status updates --><status-messagedata-variant="success"role="status"> ...</status-message>
Announcing a message after an action
1234567891011
<!-- Present (and empty) from page load --><sectionrole="status"id="form-status"></section><script> form.addEventListener('submit', () => {document.getElementById('form-status').innerHTML = ` <status-message data-variant="success" data-compact> <p data-content>Your changes have been saved.</p> </status-message>`; });</script>