Skip to content

Overlays

Overlays float above the page. Nyxwire puts every one of them on a platform feature first: the native <dialog>, the Popover API, or a positioned box you drive from a headless library. The classes also accept the data-state markup that Reka UI and Radix render, which is how the Vue components reuse the same spec.

nw-dialog styles a native <dialog>. Open it modally with dialog.showModal(): the browser puts it in the top layer, draws the ::backdrop, traps focus, closes on Escape and returns focus to the opener. dialog.show() opens it non-modally, inline.

The demos use one delegated script: data-open="#id" on a button calls showModal(), and data-close on a button inside calls close().

Reroute sector 7?

Traffic moves to the nearest healthy relay. Active sessions drop.

The body scrolls on its own when it overflows. The header, the body and the footer are optional parts.

Sessions: 312

Drop node fra-02?

A destructive flow: the edge and the glow turn danger.

Cut dialog

Cut corners and the secondary intent edge. The glow follows the chamfer through a drop-shadow.

Node list

A drawer is the same dialog docked to a viewport edge; this one slides in from the inline-end.

Bottom sheet

Docked to the bottom edge.
<div class="nw-cluster">
<button type="button" class="nw-btn" data-open="#dlg-md">Open dialog</button>
<button type="button" class="nw-btn nw-btn-soft nw-btn-danger" data-open="#dlg-danger">Danger dialog</button>
<button type="button" class="nw-btn nw-btn-outline nw-btn-secondary" data-open="#dlg-cut">Cut and wired</button>
<button type="button" class="nw-btn nw-btn-outline nw-btn-secondary" data-open="#drw-right">Drawer right</button>
<button type="button" class="nw-btn nw-btn-outline nw-btn-secondary" data-open="#drw-bottom">Drawer bottom</button>
</div>
<dialog class="nw-dialog" id="dlg-md" aria-labelledby="dlg-md-title">
<header class="nw-dialog-header">
<h2 class="nw-dialog-title" id="dlg-md-title">Reroute sector 7?</h2>
<p class="nw-dialog-description">Traffic moves to the nearest healthy relay. Active sessions drop.</p>
<button type="button" class="nw-dialog-close" data-close aria-label="Close"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg></button>
</header>
<div class="nw-dialog-body">
<p>The body scrolls on its own when it overflows. The header, the body and the footer are optional parts.</p>
</div>
<footer class="nw-dialog-footer">
<span class="nw-dialog-footer-start nw-text-subtle">Sessions: 312</span>
<button type="button" class="nw-btn nw-btn-ghost nw-btn-neutral" data-close>Cancel</button>
<button type="button" class="nw-btn" data-close>Reroute</button>
</footer>
</dialog>
<dialog class="nw-dialog nw-dialog-sm nw-dialog-danger" id="dlg-danger" aria-labelledby="dlg-danger-title">
<header class="nw-dialog-header">
<h2 class="nw-dialog-title" id="dlg-danger-title">Drop node fra-02?</h2>
<p class="nw-dialog-description">A destructive flow: the edge and the glow turn danger.</p>
</header>
<footer class="nw-dialog-footer">
<button type="button" class="nw-btn nw-btn-ghost nw-btn-neutral" data-close autofocus>Keep</button>
<button type="button" class="nw-btn nw-btn-danger" data-close>Drop</button>
</footer>
</dialog>
<dialog class="nw-dialog nw-dialog-lg nw-dialog-cut nw-dialog-secondary" id="dlg-cut" aria-labelledby="dlg-cut-title">
<header class="nw-dialog-header">
<h2 class="nw-dialog-title" id="dlg-cut-title">Cut dialog</h2>
<button type="button" class="nw-dialog-close" data-close aria-label="Close"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg></button>
</header>
<div class="nw-dialog-body"><p>Cut corners and the secondary intent edge. The glow follows the chamfer through a drop-shadow.</p></div>
<footer class="nw-dialog-footer"><button type="button" class="nw-btn" data-close>Done</button></footer>
</dialog>
<dialog class="nw-dialog nw-dialog-drawer" id="drw-right" aria-labelledby="drw-right-title">
<header class="nw-dialog-header">
<h2 class="nw-dialog-title" id="drw-right-title">Node list</h2>
<button type="button" class="nw-dialog-close" data-close aria-label="Close"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg></button>
</header>
<div class="nw-dialog-body"><p>A drawer is the same dialog docked to a viewport edge; this one slides in from the inline-end.</p></div>
<footer class="nw-dialog-footer"><button type="button" class="nw-btn" data-close>Done</button></footer>
</dialog>
<dialog class="nw-dialog nw-dialog-drawer nw-dialog-drawer-bottom" id="drw-bottom" aria-labelledby="drw-bottom-title">
<header class="nw-dialog-header">
<h2 class="nw-dialog-title" id="drw-bottom-title">Bottom sheet</h2>
<button type="button" class="nw-dialog-close" data-close aria-label="Close"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg></button>
</header>
<div class="nw-dialog-body">Docked to the bottom edge.</div>
</dialog>
native-behaviors.js
// Native behaviors for the plain-HTML component demos. The nw-* classes need none of this; it only
// wires the platform features and the documented state attributes the markup relies on.
export function bindNativeBehaviors() {
document.addEventListener('click', (event) => {
const target = event.target
if (!(target instanceof Element)) return
// [data-open="#id"] opens a modal <dialog>; [data-close] closes the dialog it sits in.
const opener = target.closest('[data-open]')
if (opener) {
const dialog = document.querySelector(opener.getAttribute('data-open'))
if (dialog instanceof HTMLDialogElement && !dialog.open) dialog.showModal()
return
}
const closer = target.closest('[data-close]')
if (closer) {
closer.closest('dialog')?.close()
return
}
// [data-toggle="#id"] flips aria-expanded on the trigger and data-state on the target, the
// contract of the navbar collapse region and of collapsible sidenav groups.
const toggle = target.closest('[data-toggle]')
if (toggle) {
const region = document.querySelector(toggle.getAttribute('data-toggle'))
const open = toggle.getAttribute('aria-expanded') !== 'true'
toggle.setAttribute('aria-expanded', String(open))
region?.setAttribute('data-state', open ? 'open' : 'closed')
return
}
// [data-toast="#template"] stamps the template's toast into the region that holds the template;
// [data-dismiss] plays the toast's exit (data-state="closed") and removes it once it ends.
const notifier = target.closest('[data-toast]')
if (notifier) {
const template = document.querySelector(notifier.getAttribute('data-toast'))
if (template instanceof HTMLTemplateElement) {
template.parentElement?.append(template.content.cloneNode(true))
}
return
}
const toast = target.closest('[data-dismiss]')?.closest('.nw-toast')
if (toast) {
toast.setAttribute('data-state', 'closed')
Promise.all(toast.getAnimations().map((animation) => animation.finished)).then(() =>
toast.remove(),
)
}
})
// Range inputs: WebKit and Blink have no progress pseudo-element, so the fill reads
// --_slider-value. An <output for="id"> mirrors the value.
const paintSlider = (slider) => {
const min = Number(slider.min || 0)
const max = Number(slider.max || 100)
const percent = ((Number(slider.value) - min) / (max - min)) * 100
slider.style.setProperty('--_slider-value', `${percent}%`)
for (const output of document.querySelectorAll('output')) {
if (output.htmlFor.contains(slider.id)) output.value = slider.value
}
}
for (const slider of document.querySelectorAll('input.nw-slider')) paintSlider(slider)
document.addEventListener('input', (event) => {
if (event.target instanceof HTMLInputElement && event.target.matches('.nw-slider'))
paintSlider(event.target)
})
// Tab lists: click and arrow keys move selection (roving tabindex), Home and End jump.
for (const tabs of document.querySelectorAll('[data-tabs]')) {
const list = tabs.querySelector('[role="tablist"]')
if (!list) continue
const vertical = list.getAttribute('aria-orientation') === 'vertical'
const enabledTabs = () => [...list.querySelectorAll('[role="tab"]:not(:disabled)')]
const select = (tab, focus) => {
for (const item of list.querySelectorAll('[role="tab"]')) {
const selected = item === tab
item.setAttribute('aria-selected', String(selected))
item.tabIndex = selected ? 0 : -1
const panel = document.getElementById(item.getAttribute('aria-controls'))
if (panel) panel.hidden = !selected
}
if (focus) tab.focus()
}
list.addEventListener('click', (event) => {
const tab = event.target instanceof Element ? event.target.closest('[role="tab"]') : null
if (tab && !tab.disabled) select(tab, false)
})
list.addEventListener('keydown', (event) => {
const all = enabledTabs()
const index = all.indexOf(document.activeElement)
if (index < 0) return
const previousKey = vertical ? 'ArrowUp' : 'ArrowLeft'
const nextKey = vertical ? 'ArrowDown' : 'ArrowRight'
let next
if (event.key === nextKey) next = all[(index + 1) % all.length]
else if (event.key === previousKey) next = all[(index - 1 + all.length) % all.length]
else if (event.key === 'Home') next = all[0]
else if (event.key === 'End') next = all[all.length - 1]
if (!next) return
event.preventDefault()
select(next, true)
})
}
// The indeterminate state of a checkbox has no attribute; it is a DOM property.
for (const box of document.querySelectorAll('[data-indeterminate]')) box.indeterminate = true
}

Always name the dialog with aria-labelledby (pointing at the title) or aria-label. Put autofocus on the safest control of a destructive dialog, as the danger example does.

Class Effect
nw-dialog The panel, medium by default: sunken fill, hairline, radius lg, an enter animation, a dimmed blurred ::backdrop.
nw-dialog-xs, -sm, -md, -lg, -xl, -full Widths 20rem, 24rem, 32rem (default), 44rem, 60rem and full viewport. Under 40rem every dialog becomes full-width.
nw-dialog-header The header part.
nw-dialog-title The title; use a heading element.
nw-dialog-description Supporting text under the title.
nw-dialog-close Close button in the header corner; needs an aria-label.
nw-dialog-body The scrolling content area; it carries the outer padding when there is no header or footer.
nw-dialog-footer The action row, pinned to the bottom.
nw-dialog-footer-start Pushes a footer item to the start, for a note beside the actions.
nw-dialog-primary … -danger Intents color the edge and the glow; the text stays the foreground.
nw-dialog-glow A resting bloom in the intent color.
nw-dialog-cut Cut corners, painted so focus rings and child popovers are not clipped; the glow follows the chamfer.
nw-dialog-drawer Docks to a viewport edge, inline-end by default.
nw-dialog-drawer-left, -top, -bottom The edge for a drawer.
[open], [data-state="open"] The visible state; the enter animation plays on open, the leave animation on data-state="closed".
.nw-dialog-backdrop A scrim element for a library-driven dialog that is not a native <dialog>.

nw-popover styles an element with the popover attribute. The Popover API gives you toggling with popovertarget, light dismiss (click outside, Escape) and top-layer stacking with no script. popovertargetaction="hide" on a button inside closes it.

The browser centers an unpositioned popover in the viewport, so these demos open in the middle of the window. In a real UI, position it with CSS anchor positioning or a library such as Floating UI.

Relay hel-01

Helsinki edge node, eu-north

Panel fill, hairline edge and the overlay shadow.

Cut corners and the gradient wire edge, in the secondary intent.
A success glow around the panel.
<div class="nw-cluster">
<button type="button" class="nw-btn nw-btn-soft" popovertarget="pop-md">Popover</button>
<button type="button" class="nw-btn nw-btn-soft" popovertarget="pop-cut">Cut and wired</button>
<button type="button" class="nw-btn nw-btn-soft" popovertarget="pop-glow">Glowing</button>
</div>
<div id="pop-md" popover class="nw-popover">
<header class="nw-popover-header">
<h3 class="nw-popover-title">Relay hel-01</h3>
<p class="nw-popover-description">Helsinki edge node, eu-north</p>
</header>
<div class="nw-popover-body"><p>Panel fill, hairline edge and the overlay shadow.</p></div>
<footer class="nw-popover-footer">
<button type="button" class="nw-btn nw-btn-ghost nw-btn-neutral nw-btn-sm" popovertarget="pop-md" popovertargetaction="hide">Close</button>
<button type="button" class="nw-btn nw-btn-sm">Ping</button>
</footer>
</div>
<div id="pop-cut" popover class="nw-popover nw-popover-sm nw-popover-cut nw-popover-wire nw-popover-secondary">
<div class="nw-popover-body">Cut corners and the gradient wire edge, in the secondary intent.</div>
</div>
<div id="pop-glow" popover class="nw-popover nw-popover-md nw-popover-glow nw-popover-success">
<div class="nw-popover-body">A success glow around the panel.</div>
</div>

nw-popover also works as a plain box, driven by data-state and data-side, which is how a positioning library renders it. An .nw-popover-arrow that is an element (not an <svg>) is a rotated square that shares the panel’s fill and edge; give it the popover’s data-side and set its inline inset from the library’s arrow coordinates.

data-state="open"
data-side="top" with an arrow
<div class="nw-cluster nw-cluster-top">
<div class="nw-popover nw-popover-sm" data-state="open" data-side="bottom">data-state="open"</div>
<div class="nw-popover nw-popover-sm" data-side="top" style="position: relative">
data-side="top" with an arrow
<span class="nw-popover-arrow" data-side="bottom" style="top: 100%; left: 50%; translate: -50% 0"></span>
</div>
</div>
Class / selector Effect
nw-popover The panel: sunken fill, hairline, radius md, overlay shadow, an enter animation on :popover-open.
nw-popover-xs, -sm, -md, -lg Widths 16rem, 20rem, 22rem (default) and 30rem.
nw-popover-header, -title, -description Header, title (use a heading) and supporting text.
nw-popover-body, -footer Content and action row. The body is the scrolling box, so the header stays put.
nw-popover-close Corner close button; needs an aria-label.
nw-popover-arrow A rotated square; an <svg> arrow is left to the library’s own styling.
nw-popover-primary … -danger Intents color the edge and the glow.
nw-popover-wire, -glow, -cut The gradient edge, a bloom, and cut corners.
[popover] Hidden until open.
:popover-open, [data-state="open"] Open state: enter animation.
[data-state="closed"] Leave animation, played by the library’s presence wrapper.
[data-side="top"], "bottom", "left", "right" Motion direction, and the arrow’s side.

nw-menu is a list of commands. It works as a static block (sidebars, menus a script renders) or as a Popover API element. A menu is a command surface, so give it role="menu" and its items role="menuitem", menuitemcheckbox or menuitemradio.

A popover menu opens and dismisses natively. The arrow-key navigation, typeahead and focus management of the menu pattern are not provided by HTML; use the Vue NwDropdownMenu family when you need them.

<button type="button" class="nw-btn nw-btn-secondary" popovertarget="menu-pop" aria-haspopup="menu">Open menu</button>
<div id="menu-pop" popover class="nw-menu" role="menu" aria-label="Node actions">
<div class="nw-menu-label">Node</div>
<button type="button" class="nw-menu-item" role="menuitem"><span class="nw-menu-icon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M5 12h14M12 5v14"/></svg></span><span class="nw-menu-item-text">Add a node</span><span class="nw-menu-shortcut">N</span></button>
<button type="button" class="nw-menu-item" role="menuitem"><span class="nw-menu-item-text">Pin to top</span><span class="nw-menu-shortcut">P</span></button>
<div class="nw-menu-separator" role="separator"></div>
<button type="button" class="nw-menu-item" role="menuitemcheckbox" aria-checked="true"><span class="nw-menu-item-text">Notify on change</span></button>
<button type="button" class="nw-menu-item" role="menuitemcheckbox" aria-checked="false"><span class="nw-menu-item-text">Auto-failover</span></button>
<div class="nw-menu-separator" role="separator"></div>
<button type="button" class="nw-menu-item nw-menu-item-danger" role="menuitem"><span class="nw-menu-item-text">Drop node</span><span class="nw-menu-shortcut">Del</span></button>
</div>

Highlight is a wash in the intent ink, on hover, on :focus-visible and on [data-highlighted], which is how a script marks the keyboard-active item.

<div class="nw-menu" role="menu" aria-label="Node" style="position: static; display: flex">
<div class="nw-menu-label">Actions</div>
<button type="button" class="nw-menu-item" role="menuitem"><span class="nw-menu-icon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="12" cy="8" r="4"/><path d="M4 21a8 8 0 0 1 16 0"/></svg></span><span class="nw-menu-item-text">Profile</span><span class="nw-menu-shortcut">P</span></button>
<button type="button" class="nw-menu-item" role="menuitem" data-highlighted><span class="nw-menu-item-text">Highlighted (data-highlighted)</span><span class="nw-menu-shortcut">I</span></button>
<button type="button" class="nw-menu-item" role="menuitem"><span class="nw-menu-item-text">With description<span class="nw-menu-item-description">A second line under the label</span></span></button>
<button type="button" class="nw-menu-item" role="menuitem" aria-haspopup="menu" aria-expanded="false"><span class="nw-menu-item-text">Submenu trigger</span></button>
<button type="button" class="nw-menu-item" role="menuitem" disabled><span class="nw-menu-item-text">Disabled</span><span class="nw-menu-shortcut">D</span></button>
<div class="nw-menu-separator" role="separator"></div>
<div class="nw-menu-label">Toggles</div>
<button type="button" class="nw-menu-item" role="menuitemcheckbox" aria-checked="true"><span class="nw-menu-item-text">Checked</span></button>
<button type="button" class="nw-menu-item" role="menuitemcheckbox" aria-checked="false"><span class="nw-menu-item-text">Unchecked</span></button>
<button type="button" class="nw-menu-item" role="menuitemcheckbox" aria-checked="mixed"><span class="nw-menu-item-text">Mixed</span></button>
<div class="nw-menu-separator" role="separator"></div>
<div class="nw-menu-group" role="group" aria-label="Sorting">
<button type="button" class="nw-menu-item" role="menuitemradio" aria-checked="false"><span class="nw-menu-item-text">Latency</span></button>
<button type="button" class="nw-menu-item" role="menuitemradio" aria-checked="true"><span class="nw-menu-item-text">Cost</span></button>
</div>
<div class="nw-menu-group" role="group">
<button type="button" class="nw-menu-item nw-menu-item-danger" role="menuitem"><span class="nw-menu-item-text">Drop everything</span><span class="nw-menu-shortcut">Del</span></button>
</div>
</div>
<div class="nw-stack nw-stack-sm">
<div class="nw-menu nw-menu-sm" role="menu" aria-label="Small" style="position: static; display: flex">
<div class="nw-menu-label">nw-menu-sm</div>
<button type="button" class="nw-menu-item" role="menuitem"><span class="nw-menu-item-text">Compact item</span><span class="nw-menu-shortcut">1</span></button>
</div>
<div class="nw-menu nw-menu-lg nw-menu-soft nw-menu-success" role="menu" aria-label="Large and soft" style="position: static; display: flex">
<div class="nw-menu-label">nw-menu-lg, soft, success</div>
<button type="button" class="nw-menu-item" role="menuitem"><span class="nw-menu-item-text">Roomy item</span><span class="nw-menu-shortcut">2</span></button>
</div>
<div class="nw-menubar" role="menubar" aria-label="Menubar">
<button type="button" class="nw-menu-item" role="menuitem" aria-haspopup="menu">File</button>
<button type="button" class="nw-menu-item" role="menuitem" aria-haspopup="menu" aria-expanded="true">Edit</button>
<button type="button" class="nw-menu-item" role="menuitem" aria-haspopup="menu">View</button>
<button type="button" class="nw-menu-item" role="menuitem" aria-haspopup="menu" disabled>Help</button>
</div>
</div>
Class / selector Effect
nw-menu The panel. As [popover] it is hidden until open, with the :popover-open enter animation.
nw-menu-sm, -lg Compact and roomy items.
nw-menu-soft The highlighted item takes the intent wash and ink instead of the neutral hover.
nw-menu-wire The gradient edge around the panel.
nw-menu-primary … -danger The intent of check marks and, in the soft variant, the highlight.
nw-menu-label Non-interactive section heading.
nw-menu-separator Divider line; give it role="separator".
nw-menu-group Wrapper for related items (role="group").
nw-menu-item A row. Use a <button>.
nw-menu-item-text, nw-menu-item-description The label cell, and a secondary line inside it.
nw-menu-icon Leading icon slot; mark it aria-hidden.
nw-menu-shortcut Trailing key hint, in mono.
nw-menu-item-danger Danger ink, and a danger wash when highlighted.
nw-menubar Horizontal row of triggers (role="menubar").
[aria-checked="true"], [aria-checked="mixed"], [data-state="checked"] Draws the check or dash mark on a checkbox or radio item.
[aria-haspopup], [aria-expanded="true"] A submenu trigger: a trailing chevron, and the highlight stays while open.
:disabled, [aria-disabled="true"], [data-disabled] Disabled item.
[data-highlighted] Keyboard-active item.
[data-state="open"], [data-state="closed"] Enter and leave motion for a script-rendered menu.

There are two tooltips, for two kinds of control.

[data-tooltip] (CSS only) needs no markup. The text comes from the attribute and shows on hover and :focus-visible after a short delay. Placement is data-side (top by default, then bottom, left, right); an empty attribute renders nothing. The label is an absolutely positioned pseudo-element, so near the edge of a narrow page it can widen the page: keep it away from overflow: hidden ancestors and edge-of-screen triggers. It has no touch path and is not announced as a description, so keep the same information in a visible label or aria-label for essential controls.

<div class="nw-cluster">
<button type="button" class="nw-btn nw-btn-outline nw-btn-neutral" data-tooltip="Default placement: top">Top</button>
<button type="button" class="nw-btn nw-btn-outline nw-btn-neutral" data-tooltip="Placement: bottom" data-side="bottom">Bottom</button>
<button type="button" class="nw-btn nw-btn-outline nw-btn-neutral" data-tooltip="Placement: left" data-side="left">Left</button>
<button type="button" class="nw-btn nw-btn-outline nw-btn-neutral" data-tooltip="Placement: right" data-side="right">Right</button>
<button type="button" class="nw-btn nw-btn-outline nw-btn-neutral" data-tooltip="A longer tooltip that wraps onto a second line once it passes its measure" data-side="bottom">Long text</button>
</div>

.nw-tooltip (positioned box) is the box itself. A script (the Vue NwTooltip, Floating UI) positions it next to its anchor and sets data-state and data-side. It carries role="tooltip" and should be referenced from the anchor with aria-describedby. Shown here statically:

Reroute the sectorR data-side="bottom" Warning tooltip
<div class="nw-cluster nw-cluster-top">
<span class="nw-tooltip" role="tooltip" data-state="open" data-side="top">Reroute the sector<kbd class="nw-tooltip-kbd">R</kbd></span>
<span class="nw-tooltip" role="tooltip" data-state="open" data-side="bottom">data-side="bottom"</span>
<span class="nw-tooltip nw-tooltip-sm nw-tooltip-warning" role="tooltip" data-state="open" data-side="bottom">Warning tooltip<span class="nw-tooltip-arrow" data-side="top" style="bottom: 100%; left: 50%; translate: -50% 0"></span></span>
</div>
Class / attribute Effect
[data-tooltip] Adds a CSS-only tooltip from the attribute value.
[data-side] top (default), bottom, left or right, on both the pseudo-element and the box.
nw-tooltip The box: sunken fill, strong hairline, small type, no pointer events.
nw-tooltip-kbd A trailing key hint inside the box.
nw-tooltip-arrow An element arrow: a rotated square in the box’s own fill; give it the box’s data-side.
nw-tooltip-xs, -sm, -md, -lg Type and padding.
nw-tooltip-primary … -danger Intents color the border and the kbd.
nw-tooltip-glow A bloom around the box.
[data-state="open"], [data-state="closed"] Enter and leave animation.

A toast is a transient message. The CSS styles the elements; a script adds them to a nw-toast-region, removes them and sets data-state="closed" for the leave motion. The region is position: fixed, pinned to a corner; the demo overrides that inline so it can sit inside the page. In the demo the region also holds the <template> elements: a button stamps a template’s toast into the region (data-toast="#tpl-id") and the close buttons play the exit (data-dismiss).

Use role="status" for routine messages and role="alert" for errors. Do not put an action that exists nowhere else in a toast: it disappears.

Deployed

Build 412 is live on every relay.

Default (primary)

The timer drains over --nw-toast-duration.

<div class="nw-cluster nw-cluster-top">
<button type="button" class="nw-btn nw-btn-soft" data-toast="#tpl-success">Success toast</button>
<button type="button" class="nw-btn nw-btn-soft nw-btn-warning" data-toast="#tpl-warning">Warning toast</button>
</div>
<div class="nw-toast-region" role="region" aria-label="Notifications" style="position: static; width: auto; translate: none">
<div class="nw-toast nw-toast-success" role="status" data-state="open">
<svg class="nw-toast-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 13l4 4L19 7"/></svg>
<div class="nw-toast-body">
<p class="nw-toast-title">Deployed</p>
<p class="nw-toast-description">Build 412 is live on every relay.</p>
</div>
<button type="button" class="nw-toast-close" data-dismiss aria-label="Dismiss"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg></button>
<span class="nw-toast-timer" aria-hidden="true"></span>
</div>
<div class="nw-toast" role="status" data-state="open">
<div class="nw-toast-body">
<p class="nw-toast-title">Default (primary)</p>
<p class="nw-toast-description">The timer drains over --nw-toast-duration.</p>
<div class="nw-toast-actions"><button type="button" class="nw-btn nw-btn-sm nw-btn-ghost">View</button></div>
</div>
<button type="button" class="nw-toast-close" data-dismiss aria-label="Dismiss"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg></button>
<span class="nw-toast-timer" aria-hidden="true"></span>
</div>
<div class="nw-toast nw-toast-warning nw-toast-solid" role="alert" data-state="open">
<div class="nw-toast-body">
<p class="nw-toast-title">Uplink degraded</p>
<p class="nw-toast-description">Solid variant, warning intent.</p>
</div>
<button type="button" class="nw-toast-close" data-dismiss aria-label="Dismiss"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg></button>
</div>
<template id="tpl-success">
<div class="nw-toast nw-toast-success" role="status">
<svg class="nw-toast-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 13l4 4L19 7"/></svg>
<div class="nw-toast-body">
<p class="nw-toast-title">Deployed</p>
<p class="nw-toast-description">A fresh toast, stamped into this region.</p>
<div class="nw-toast-actions"><button type="button" class="nw-btn nw-btn-sm nw-btn-ghost" data-dismiss>Dismiss</button></div>
</div>
<button type="button" class="nw-toast-close" data-dismiss aria-label="Dismiss"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg></button>
<span class="nw-toast-timer nw-motion-essential" aria-hidden="true"></span>
</div>
</template>
<template id="tpl-warning">
<div class="nw-toast nw-toast-warning" role="alert">
<div class="nw-toast-body">
<p class="nw-toast-title">Uplink degraded</p>
<p class="nw-toast-description">role="alert", for messages that need attention now.</p>
</div>
<button type="button" class="nw-toast-close" data-dismiss aria-label="Dismiss"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg></button>
<span class="nw-toast-timer nw-motion-essential" aria-hidden="true"></span>
</div>
</template>
</div>
Class / attribute Effect
nw-toast-region Fixed stack container (role="region" with an aria-label). Bottom-right by default; top regions reverse the stacking order.
nw-toast-region-top-left, -top-center, -top-right, -bottom-left, -bottom-center Region position; the default region is the bottom-right one.
nw-toast The toast: sunken fill, hairline, slide-in, a draining timer along the bottom edge. Primary by default.
nw-toast-primary … -danger Intent of the icon and the timer.
nw-toast-solid Opaque panel for pages without a backdrop.
nw-toast-soft A soft intent tint over the panel instead of the sunken fill.
nw-toast-icon Leading icon; mark it aria-hidden. Without it the body starts at the edge.
nw-toast-body The text column.
nw-toast-title, nw-toast-description Text parts.
nw-toast-actions Action buttons.
nw-toast-close Dismiss button; needs an aria-label.
nw-toast-timer Countdown bar. It drains over --nw-toast-duration (5s by default) and pauses while the toast is hovered or holds focus.
nw-toast-wire, -glow, -cut The gradient edge, a bloom, and cut corners.
nw-toast-xs, -sm, -md, -lg Toast sizes.
[data-state="open"], [data-state="closed"] Enter and leave motion; play closed, then remove the node.
[data-toast="#template-id"] Demo wiring: stamps the template’s toast into the region that holds the template.
[data-dismiss] Demo wiring: plays data-state="closed", then removes the toast once its animations end.
[data-swipe="move"], "cancel", "end" Swipe-to-dismiss states, following the region’s swipe axis.

The timer is meaningful motion: mark the timer of a toast that really auto-dismisses with nw-motion-essential so the countdown keeps its duration under reduced motion; otherwise the track is hidden rather than frozen at a misleading width.