Searching Puzzle Pieces

Type to search Puzzle Pieces.

Toast

An imperative toast() API with a host that mounts once in your layout — variants, pausable auto-dismiss, and corner positioning.

Installation

Toast is two files — the store and public API in toast.js, and the Toaster host that renders them. Copy both into your app:

puzzle add piece toast

Requires the pieces.css tokens merged into your app styles (see Introduction).

Usage

import { toast } from '@/components/ui/toast.js';
toast('Your draft was saved.');

Sticky and dismissal

Setup

Mount a single Toaster host once, near the root of your app layout, and pick a corner with the position prop. Then call toast() from anywhere — the host subscribes to the store and renders every notification.

// app/layouts/AppLayout.pzl — mount the host once, near the root
import Toaster from '@/components/ui/Toaster.pzl';
<Toaster position="bottom-right" />

// then, from any view or module
import { toast } from '@/components/ui/toast.js';
toast('Saved!');

This demo's layout already mounts a Toaster, which is why the buttons above just work.