Toast
Announce transient status from an explicit toaster. Custom element
<ui-toaster role="region" aria-label="Notifications" placement="bottom-end" stack="overlap"> <ui-toast role="status"> <div data-ui-part="content"> <h2 data-ui-part="title">Preview ready</h2> <p data-ui-part="description">The static example finished building.</p> </div> <button data-ui-part="close" type="button" aria-label="Dismiss notification"> <svg aria-hidden="true" focusable="false" viewBox="0 0 16 16"> <path d="m4.5 4.5 7 7m0-7-7 7" fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="1"/> </svg> </button> </ui-toast></ui-toaster>Install
import '@timelessui/components/css/tokens.css'import '@timelessui/components/css/toast.css'import '@timelessui/components/define/ui-toaster'import '@timelessui/components/define/ui-toast'Anatomy
Parts are authored in your own markup and identified by the selector below, so your CSS can target the same anatomy without loading Timeless styles. Required parts must be present for the component to work. Private data-ui-internal-* hooks are written by the runtime and must never be authored.
<ui-toast>
| Part | Required | Selector | Purpose |
|---|---|---|---|
content | No | [data-ui-part~='content'] | Wrapper for the title and description. |
title | No | [data-ui-part~='title'] | Short summary line. |
description | No | [data-ui-part~='description'] | Supporting detail. |
close | No | [data-ui-part~='close'] | Dismiss button. Give it an accessible name. |
Attributes
Every value below is implemented by the stylesheets this component ships. Boolean attributes are presence-based: author the attribute with no value, or omit it.
<ui-toaster>
| Attribute | Values | Default | Description |
|---|---|---|---|
placement | top-start · top-center · top-end · bottom-start · bottom-center · bottom-end | bottom-end | Corner or edge of the viewport the toasts stack against. |
stack | overlap · list | overlap | Whether queued toasts overlap into a deck (overlap) or lay out as a full list (list). |
<ui-toast>
| Attribute | Values | Default | Description |
|---|---|---|---|
duration | any number | 5000 | Milliseconds before the toast dismisses itself. 0 keeps it open until dismissed. |
persistent | presence | absent | Present to disable auto-dismiss regardless of duration. |
Element API
Attributes above are the authoring surface. These are the DOM properties and events the registered element adds once it upgrades.
<ui-toaster>
| Property | Type | Notes |
|---|---|---|
placement | 'top-start' | 'top-center' | 'top-end' | 'bottom-start' | 'bottom-center' | 'bottom-end' | Reflects the placement attribute, documented above. |
stack | 'overlap' | 'list' | Reflects the stack attribute, documented above. |
This element dispatches no component events.
<ui-toast>
| Property | Type | Notes |
|---|---|---|
duration | string | Reflects the duration attribute, documented above. |
persistent | boolean | Reflects the persistent attribute, documented above. |
| Event | Detail | Description |
|---|---|---|
ui-dismiss | CustomEvent<ToastDismissDetail> | Dispatched when the toast is dismissed. The detail names the reason: a timeout, the close control, or the imperative API. |
Styling
Root identity: ui-toaster, ui-toast. Required stylesheets: tokens.css, toast.css.
Set these custom properties to restyle the component:
| Custom property | Controls |
|---|---|
--ui-toaster-gap | Gap between toasts in list mode. |
--ui-toaster-overlap | Offset between stacked toasts in overlap mode. |
Design tokens this component reads (13)
These are global Atmosphere tokens. Change them once at the theme level rather than per component.
--ui-bg-control · --ui-bg-surface · --ui-fg · --ui-fg-muted · --ui-focus · --ui-line · --ui-radius-lg · --ui-radius-md · --ui-shadow-floating · --ui-space-1 · --ui-space-3 · --ui-space-4 · --ui-space-5
Accessibility
Keep the native elements, roles, and relationships shown in the example. Timeless adds only the state and keyboard coordination the platform does not already provide, and it never supplies your accessible names — those depend on your content.
Before JavaScript runs
The markup above is complete and usable on its own: native controls submit, labels associate, and authored ARIA is already correct. Registration adds state synchronisation, focus management, and keyboard coordination on top of it.
More examples
Open Toast in StoryLite for variants, controls, and manual testing.