Toast

Auto-dismissing slide-in notifications with stacking and color variants.

This component requires softui.js for interactive behavior.

Default

<!-- Trigger a toast from a button -->
<button class="sui-btn sui-btn-primary"
  onclick="SoftUI.toast({ title: 'Notification', message: 'This is a default toast message.' })">
  Show Toast
</button>

<!-- Or call from JavaScript -->
<script>
  SoftUI.toast({
    title: 'Notification',
    message: 'This is a default toast message.'
  });

  // Persistent toast (no auto-dismiss)
  SoftUI.toast({
    title: 'No auto-close',
    message: 'This toast stays until you dismiss it.',
    duration: 0
  });
</script>

Variants

SoftUI.toast({
  title: 'Success',
  message: 'Your changes have been saved.',
  variant: 'success'
});

SoftUI.toast({
  title: 'Error',
  message: 'Something went wrong. Please try again.',
  variant: 'danger'
});

SoftUI.toast({
  title: 'Warning',
  message: 'Your session will expire in 5 minutes.',
  variant: 'warning'
});

SoftUI.toast({
  title: 'Info',
  message: 'A new version is available.',
  variant: 'info'
});

Positions

SoftUI.toast({
  title: 'Top Right',
  message: 'Default position.',
  position: 'tr'
});

SoftUI.toast({
  title: 'Top Left',
  message: 'Slides in from the left.',
  position: 'tl'
});

SoftUI.toast({
  title: 'Bottom Right',
  message: 'Bottom right corner.',
  position: 'br'
});

SoftUI.toast({
  title: 'Bottom Left',
  message: 'Bottom left corner.',
  position: 'bl'
});

SoftUI.toast({
  title: 'Top Center',
  message: 'Centered at the top.',
  position: 'tc'
});

SoftUI.toast({
  title: 'Bottom Center',
  message: 'Centered at the bottom.',
  position: 'bc'
});

Reference

Option / APIDescription
SoftUI.toast(options)Shows a toast and returns its element.
titleBold heading text.
messageBody text.
variant'success', 'danger', 'warning' or 'info'. Default: none.
durationMilliseconds before it closes. Default 4000; 0 keeps it open.
position'tr', 'tl', 'br', 'bl', 'tc' or 'bc'. Default 'tr'.
closableShows the close button. Default true.
htmlRenders title and message as HTML. Default false (plain text). Only pass trusted HTML, never user input.

Delete this item?

This action cannot be undone. This will permanently delete the item and remove all associated data.