Toast

Brief feedback for status updates or actions.

When to use

Use a toast for brief feedback after an action, such as a completed save. Keep critical errors or feedback requiring a response in a persistent Alert near the affected content.

Default

Use .toast for a notification.

Project settings saved.
HTML
<div class="toast">Project settings saved.</div>

Insert dynamic toasts into a persistent polite live region.

HTML
<div role="status" aria-live="polite" aria-atomic="false">
	<!-- Insert new toast elements here. -->
</div>

Background colors

Combine .toast with a background utility.

toast primary
toast secondary
toast success
toast warning
toast error
toast inverse
HTML
<div class="toast bg-primary">toast primary</div>
<div class="toast bg-secondary">toast secondary</div>
<div class="toast bg-success">toast success</div>
<div class="toast bg-warning">toast warning</div>
<div class="toast bg-error">toast error</div>
<div class="toast bg-inverse">toast inverse</div>

With content

Use .toast-content, .toast-title and .toast-message for structure.

Update available

A new version is ready to install.

HTML
<div class="toast bg-surface">
	<div class="toast-content">
		<p class="toast-title">Update available</p>
		<p class="toast-message">A new version is ready to install.</p>
	</div>
</div>

Closable

Use .toast-close for the close action.

Save failed

Project settings could not be saved. Try again.

HTML
<div class="toast bg-error">
	<div class="toast-content">
		<p class="toast-title">Save failed</p>
		<p class="toast-message">Project settings could not be saved. Try again.</p>
	</div>

	<button class="toast-close icon-btn icon-btn-text" type="button" aria-label="Close toast">
		×
	</button>
</div>

Accessibility and behavior

  • Insert dynamic notifications into an existing polite live region so new feedback can be announced. Reserve assertive announcements for urgent events and avoid duplicate live regions.
  • Keep messages concise and make important results available elsewhere when a toast is temporary. Do not rely on color alone.
  • Use a named native button for dismissal. Consuming applications own creation, timing, focus handling and removal; the published package supplies styles.

CSS variables

Override these base defaults on the listed selector after the library styles. Variants and states may replace them; global tokens follow the active theme.

TokenDefaultPurposeScope / state
--toast-z-indexvar(--z-index-toast)Stacking order..toast
--toast-padding-yvar(--spacer-2)Top and bottom padding..toast
--toast-padding-xvar(--spacer-3)Left and right padding..toast
--toast-bg-colorvar(--bg-surface)Background color..toast
--toast-colorvar(--text-color)Text and icon color..toast
--toast-border-widthvar(--border-width)Border thickness..toast
--toast-border-colortransparentBorder color..toast
--toast-border-radiusvar(--border-radius)Corner radius..toast
--toast-box-shadowvar(--shadow)Outer shadow..toast
--toast-gapvar(--spacer-2)Space between child elements..toast