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 |
|---|---|---|---|
variant | string | 'info' | Toast type: 'success', 'error', 'warning', 'info' |
title | string | — | Optional bold title above the message |
message | string | — | Main toast message body (required) |
timeout | number | 5000 | Auto-dismiss delay in ms. Set to 0 to persist until manually closed. |
position | string | '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:
Claim approved
Claim #CLM-2024-0041 has been approved and payment is on its way.
Payment failed
Your card ending in 4242 was declined. Please update your payment method.
Your session will expire in 5 minutes. Save your work.
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>