Components

Toasts

Lightweight push notifications with auto-dismiss.

Stable Requires JS

JavaScript API (recommended)

The primary way to show toasts is via the BIMA.toast() API. It creates, inserts, and auto-dismisses the toast for you.

// Success toast
BIMA.toast({
  variant: 'success',
  title: 'Claim submitted',
  message: 'Your claim has been received and is under review.',
  timeout: 5000 // ms, default: 5000; set to 0 to disable auto-dismiss
});

// Error toast
BIMA.toast({
  variant: 'error',
  title: 'Payment failed',
  message: 'We were unable to charge your card.'
});

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

// Info toast
BIMA.toast({
  variant: 'info',
  message: 'A new policy template is available.'
});

Options reference

Option Type Default Description
variantstring'info'Toast type: 'success', 'error', 'warning', 'info'
titlestring—Optional bold title above the message
messagestring—Main toast message body (required)
timeoutnumber5000Auto-dismiss delay in ms. Set to 0 to persist until manually closed.
positionstring'top-end'Toast stack position: 'top-end', 'top-start', 'bottom-end', 'bottom-start'

Static HTML structure

If you need to build toast HTML manually (e.g., for server-rendered notifications), use this structure:

A new policy template has been added to your account.
<div class="bima-toast bima-toast--success"
     role="alert" aria-live="assertive" aria-atomic="true">
  <div class="bima-toast__header">
    <strong class="bima-toast__title">Claim approved</strong>
    <button type="button" class="bima-close bima-close--white"
            aria-label="Dismiss">...</button>
  </div>
  <div class="bima-toast__body">
    Claim #CLM-2024-0041 has been approved.
  </div>
</div>