Pixel UI/Overlays/Toast

Toast

Notifications with a pixel fuse that burns down while they are up.

<piix-toaster>WebGL
Success Error Info

Call Piixpal.toast() from anywhere. Toasts step in from the corner, stack up, and along the bottom a thin pixel fuse burns down with a spark at its tip. When it runs out the toast wipes away. Hover or focus one and the fuse stops. Add a <piix-toaster> if you want to choose the corner or the theme.

Installation

<!-- once, anywhere on the page: every component -->
<script src="https://cdn.jsdelivr.net/npm/piixpal@0.6/piixpal.min.js"></script>

Usage

Piixpal.toast('Copied to clipboard');

Piixpal.toast('Your changes are live.', {
  tone: 'ok',            // info | ok | warn | error
  title: 'Deployed',
  duration: 4.5,         // seconds; 0 stays until closed
  action: { label: 'View site', onClick: () => open('/') }
});

Examples

Light, at the top

One toaster per page sets where and how they show.

Set on the page: <piix-toaster position="top" theme="light">

API reference

AttributeWhat it doesDefault
toneinfo ok warn errorinfo
titlea bold first line–
durationseconds before it burns out; 0 keeps it4.5
action{ label, onClick }: a button in the toast–
position (toaster)bottom-right bottom-left top-right top-left bottom topbottom-right
theme (toaster)dark lightdark

Accessibility