Skip to main content
VelinStyle v1.3.0
⌂ Home
  1. Docs
  2. Components
  3. Feedback
  4. Toasts

Toasts 1.2.2

<velin-toast> is a fixed, stacking notification host. Call show({ message, type, duration }) to push dismissible toasts. Stable feedback overlay adjacent to modal/dialog patterns in 1.2.0 (does not use focus-manager inert — toasts are non-modal). Deutsch: Toasts De

Maturity: Documented as stable in VelinStyle 1.2.0. Design Intelligence (plan / review / agent meta) is separate and beta / foundation where noted.

When to use

When not

Basic toast

Place one host on the page. Invoke show() from JavaScript.

<velin-toast id="toasts"></velin-toast>

<button type="button" class="velin-btn velin-btn--primary"
        onclick="document.getElementById('toasts').show({
          message: 'Hello! This is a toast message.',
          type: 'info'
        })">
  Show toast
</button>

Types

Pass type to show(): info (default), success, warning, danger, or error (assertive live region like danger).

const t = document.getElementById('toasts');
t.show({ message: 'Changes saved!', type: 'success' });
t.show({ message: 'Something went wrong.', type: 'danger' });
t.show({ message: 'Check your input.', type: 'warning' });
t.show({ message: 'New update available.', type: 'info' });

Auto-dismiss

duration is milliseconds (default 5000). Use 0 to keep the toast until the close button is pressed.

t.show({ message: 'Quick notification', duration: 3000 });
t.show({ message: 'Persistent toast', duration: 0 });

Stacking

Multiple show() calls append toast nodes inside the same host. The host is fixed at the block-end / inline-end corner and stacks with flex-direction: column-reverse.

<!-- One host is enough — do not invent .velin-toast-container -->
<velin-toast id="toasts"></velin-toast>

Accessibility

Dark, responsive, motion, RTL

API

Methods

MethodDescription
show({ message, type = 'info', duration = 5000 })Appends a toast node; returns the toast element

CSS variables

VariableDescription
--velin-z-toastHost z-index (default 600)
--velin-color-surface-brightToast background
--velin-color-success / warning / danger / infoType accents
--velin-shadow-lg, --velin-radius-mdChrome

Best practices & pitfalls