Zum Hauptinhalt springen
VelinStyle v1.2.0
⌂ Startseite
  1. Erste Schritte
  2. Komponenten
  3. Toasts

Toasts 1.2.0

<velin-toast> ist ein fixer, stapelnder Notification-Host. Rufe show({ message, type, duration }) auf, um schließbare Toasts zu pushen. Stabiles Feedback-Overlay neben Modal-/Dialog-Patterns in 1.2.0 (does not use focus-manager inert — toasts are non-modal). English: Toasts

Reifegrad: Dokumentiert als stabil in VelinStyle 1.2.0. Design Intelligence (Plan / Review / Agent-Meta) ist separat und Beta / Foundation wo vermerkt.

Wann verwenden

Wann nicht

Basis-Toast

Platziere einen Host auf der Seite. Rufe show() aus JavaScript auf.

<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>

Typen

Pass type auf 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' });

Automatisches Schließen

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>

Barrierefreiheit

Dark, Responsive, Motion, RTL

API

Methoden

MethodeBeschreibung
show({ message, type = 'info', duration = 5000 })Hängt einen Toast-Node an; gibt das Toast-Element zurück

CSS-Variablen

VariableBeschreibung
--velin-z-toastHost-z-index (Standard 600)
--velin-color-surface-brightToast-Hintergrund
--velin-color-success / warning / danger / infoTyp-Akzente
--velin-shadow-lg, --velin-radius-mdChrome

Best Practices & Fallstricke