Fine-tune light, shadows, borders, neumorphic
Light and shadows
Borders
Neumorphic
Overlays

Toaster <pm-toaster>

Where toasts appear and how many stack. Optional: toast() works without it.

Full screen
Success Error Warning Info

Props

<script type="module"> import '@prismora/css'; import '@prismora/elements/button'; import '@prismora/elements/toaster'; </script> <pm-toaster position="bottom-end"></pm-toaster> <pm-button tone="success" data-toast='{"title":"Changes saved","description":"Your profile is up to date.","tone":"success"}'>Success</pm-button> <pm-button tone="danger" variant="soft" data-toast='{"title":"Payment failed","description":"Your card was declined.","tone":"danger"}'>Error</pm-button> <pm-button tone="warning" variant="soft" data-toast='{"title":"Storage almost full","description":"90% of 10 GB used.","tone":"warning"}'>Warning</pm-button> <pm-button variant="outline" tone="neutral" data-toast='{"title":"Message archived","tone":"info","duration":6000}'>Info</pm-button>

Overview

Optional: toast() creates a region on demand; add <pm-toaster> once to choose where toasts appear and how many stack. Any element with data-toast shows a toast when clicked (no JS needed): data-toast="Saved" or data-toast='{"title":"Saved","tone":"success"}'. In JS use toast(), toast.success(), toast.error(), toast.promise() and toast.dismiss() from @prismora/elements/toast. On phones toasts are centred and full width (top or bottom, following position) unless keep-position is set.

Attributes

AttributeTypeDefaultDescription
labelstring—Accessible name of the region (default "Notifications").
position'top-start' | 'top-center' | 'top-end' | 'bottom-start' | 'bottom-center' | 'bottom-end'—Where toasts stack (default bottom-end).
maxnumber—Most toasts shown at once; older ones leave first (default 4).
keep-position
prop: keepPosition
boolean—Keep position on phones instead of centring.

Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.

Methods

show()