Skip to content

Toast

.bp-toast renders feedback notifications in a fixed bottom-right stack. The BpToast.show() JS API creates toasts dynamically — no HTML authoring needed. Supports four semantic variants, configurable auto-dismiss, manual close, and an optional action button.

All variants

<style>
.demo-toast__actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
</style>
<div class="demo-toast__actions">
<button class="bp-btn" type="button"
onclick="BpToast.show({ message: 'Changes saved', variant: 'success' })">
Success
</button>
<button class="bp-btn bp-btn--secondary" type="button"
onclick="BpToast.show({ message: 'Upload failed — max 10 MB', variant: 'error' })">
Error
</button>
<button class="bp-btn bp-btn--secondary" type="button"
onclick="BpToast.show({ message: 'Session expiring in 5 min', variant: 'warning' })">
Warning
</button>
<button class="bp-btn bp-btn--secondary" type="button"
onclick="BpToast.show({ message: 'Message deleted', variant: 'info', action: { label: 'Undo', onClick: () => console.log('undo') } })">
Info + Undo
</button>
</div>
// Include once per page: <script src="/bp-toast.js"></script>
BpToast.show({
message: 'Changes saved',
variant: 'success', // 'success' | 'error' | 'warning' | 'info' (default: 'info')
duration: 3000, // ms before auto-dismiss; 0 = no auto-dismiss (default: 3000)
action: {
// optional
label: 'Undo',
onClick: () => {},
},
})

No auto-dismiss (persistent)

<button class="bp-btn" type="button"
onclick="BpToast.show({ message: 'Background sync in progress', variant: 'info', duration: 0 })">
Show persistent toast
</button>
VariableDefaultDescription
--toast-width22remWidth of each toast (set on region)
--toast-radiusvar(--bp-radius-lg)Border radius
--toast-bgcolor-mix tintedBackground override
--toast-colorvar(--bp-color-text)Text color override
--toast-bordertransparentBorder color override
ClassTokenUse for
bp-toast--success--bp-color-successConfirmation, save, completion
bp-toast--error--bp-color-errorFailures, destructive outcomes
bp-toast--warning--bp-color-warningNon-blocking caution
bp-toast--info--bp-color-infoNeutral updates
No axe violations tested 2026-05-11
  • role="status" (polite) on success/warning/info toasts; role="alert" (assertive) on error toasts.
  • Two hidden aria-live regions are created lazily in the DOM — they mirror the toast message for reliable screen reader announcement regardless of stacking context.
  • Auto-dismiss is paused on mouseenter — satisfies WCAG 2.2.2 (Pause, Stop, Hide).
  • Close button has aria-label="Dismiss" — required for icon-only controls.
  • Toast icon is aria-hidden="true" — decorative only.
  • Color is never the sole differentiator — icon + text always present.
  • All interactive elements (close, action) have :focus-visible rings via var(--bp-focus-ring).
APIAvailabilityUsed forWithout itPolyfill
@starting-style Newly available Baseline 2024 Slide-up entrance animationToast appears instantlyNone needed
color-mix() Widely available Baseline 2023 Tinted variant backgroundsSolid token colorNone needed
isolation: isolate Widely available Baseline 2020 Self-contained stacking contextInherits page stackingNone needed
  • #bp-toast-region is created lazily by JS on first BpToast.show() call — do not place it manually.
  • --_border is component-private — do not set directly. Use the variant classes.