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.
<div class="toast">Project settings saved.</div>Insert dynamic toasts into a persistent polite live region.
<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
<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
<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
<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.
| Token | Default | Purpose | Scope / state |
|---|---|---|---|
--toast-z-index | var(--z-index-toast) | Stacking order. | .toast |
--toast-padding-y | var(--spacer-2) | Top and bottom padding. | .toast |
--toast-padding-x | var(--spacer-3) | Left and right padding. | .toast |
--toast-bg-color | var(--bg-surface) | Background color. | .toast |
--toast-color | var(--text-color) | Text and icon color. | .toast |
--toast-border-width | var(--border-width) | Border thickness. | .toast |
--toast-border-color | transparent | Border color. | .toast |
--toast-border-radius | var(--border-radius) | Corner radius. | .toast |
--toast-box-shadow | var(--shadow) | Outer shadow. | .toast |
--toast-gap | var(--spacer-2) | Space between child elements. | .toast |