Small library. Clear feedback.

Notify
Keep people in the loop.

Toast notifications for the moments that matter.
Confirm a save, follow a promise, or offer a way back.

npm install @samline/notify

Zero runtime dependenciesJavaScript & TypeScriptMIT licensed

Notify playground
Toast typesLive · @samline/notify

Every kind of feedback

One call. The right tone.

Pick a type to send a real notification. Change the position or the options, then hover the stack to expand it.

toast.success('Changes saved')

Each button calls the same toast API you install. Options update the mounted toaster in place; hover or focus pauses timers and swipe dismisses.

Save changesLive · @samline/notify

Profile settings

A little more like you.

Update your public display name. Nothing leaves this page.

Your profile is up to date.

A loading notification becomes a success on the same id. The saved name stays visible in the form.

Error and retryLive · @samline/notify

Report delivery

Your report, ready to send.

Send the October report. The first simulated request fails; retrying succeeds.

October report · Not sent

An error stays available with a real Retry action. Retry changes the local delivery receipt.

Custom contentLive · @samline/notify

Release desk

A release ready for review.

Open a release card, write a note inside the notification and save it back to the page. Your integration owns the DOM and appearance.

Release 4.0.0 · Ready for review

toast.custom uses safe DOM construction. Your integration supplies the custom appearance and close action.

One small package. Right at home in your stack.

JavaScript TypeScript React Vue Svelte Astro Shopify WordPress
01 / Feedback that fits

A small moment.
A clear next step.

Just the package

No framework runtime or peer dependency. Import the toast API and its stylesheet, then mount one renderer.

Made to be read

Polite live updates, keyboard controls and focus-paused timers. Your app chooses readable content, contrast and enough time to act.

One place to mount

Create one toaster at your client root. Keep its controller to update preferences, and destroy it when the integration leaves.

Package or script tag

Use ESM or CommonJS in your build, or a standalone browser script. The stylesheet is a separate asset in either setup.

Your application, your flow

Use the ordinary DOM API from React, Vue, Svelte, Astro or a CMS. No framework-specific component or adapter is required.

More than a success message

Follow cancelable work, chain review and decision actions, keep a live activity stack, or build an editable card with your own DOM.

02 / Fit it into your stack

Two ways in. One toast API.

Choose package imports or a plain script tag. The module registry is optional; types and styles are supporting resources.

Package / ESM + CommonJS

@samline/notify

The toast factory, singleton lifecycle, types and advanced exports. Module imports do not install a global or mount a renderer.

Optional module registry

@samline/notify/browser

The same singleton toast and toaster helpers collected in one object. This import does not create window.Notify.

HTML / CDN

window.Notify

Load the standalone script and stylesheet. The script mounts a default toaster when the body is ready.

Styles

@samline/notify/style.css

The required layout, stack, color and reduced-motion styles. Import once, then add your own CSS after the package stylesheet.

03 / From install to feedback

One button. Your first toast.

Install the package or load the CDN assets. Choose the matching initializer after the body is ready. Load main.js as a module for ESM, or with defer after the deferred CDN script.

Read the installation guide
1

Load Notify

Terminal
npm install @samline/notify
Terminal
pnpm add @samline/notify
Terminal
yarn add @samline/notify
Terminal
bun add @samline/notify
Terminal
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@samline/notify@5.0.1/dist/style.css">
<script src="https://cdn.jsdelivr.net/npm/@samline/notify@5.0.1/dist/browser/notify.global.js" defer></script>
2

Add a trigger

Use a native button. Notify creates the notification markup for you.

index.html
<button id="save" type="button">Save changes</button>
3

Mount and notify

main.js
import { createToaster, toast } from '@samline/notify'
import '@samline/notify/style.css'

const toaster = createToaster({ richColors: true })

document.querySelector('#save').addEventListener('click', () => {
  toast.success('Changes saved')
})
main.js
// Load the CDN stylesheet and script first.
const notify = window.Notify
const toaster = notify.createToaster({ richColors: true })

document.querySelector('#save').addEventListener('click', () => {
  notify.toast.success('Changes saved')
})
Copy complete working files

Mount once near the client root. The examples below continue with this toaster; complete standalone files are available in the guide.

Explore the configuration reference
04 / After the first toast

Keep the feedback useful.
Keep ownership clear.

Continue from the instance above. Use the same toast id for progress, update the existing controller, and clean up when the application tears down.

Progress

Update a notification in place

Keep the id returned by a loading toast. Replace its message and type when the task completes; loading itself has no automatic timeout.

Read the toast API
progress.js
const id = toast.loading('Preparing your report…')

// When your application finishes the work:
toast.success('Your report is ready', { id })
Controller

Change preferences without remounting

Update the existing toaster when your theme or layout changes. Omitted options keep their current values.

Read the configuration reference
preferences.js
toaster.update({
  theme: 'dark',
  position: 'top-right',
  closeButton: true,
})
Lifecycle

Leave the page clean

At application teardown, destroy the singleton and publish its dismissals. Mount again explicitly if the integration returns.

Understand cleanup and remounting
cleanup.js
import { destroyToaster } from '@samline/notify'

// In your application or component cleanup:
destroyToaster()
Try the complete working examples
05 / Before you build

A few details. Clearly answered.

Do I need a toaster before calling toast?
Yes, for visible feedback. Module imports do not mount anything: call createToaster once after document.body exists. The standalone script auto-mounts once. Calling createToaster again updates the same singleton.
Can I use it with my framework or CMS?
Yes. Mount from the client lifecycle and load the stylesheet once. React, Vue, Svelte, Astro, Shopify and WordPress use the same DOM API; the integration guide explains cleanup and the limits of the CMS fixtures.
What does toast.promise return?
An object with unwrap(), plus an id when a loading message was supplied. unwrap preserves the input outcome. A fulfilled HTTP error response can show an error notification while unwrap still fulfills with that response.
Will people have enough time to read or act?
Timers pause on hover, keyboard focus and a hidden document. Choose a duration suited to the content. Use Infinity with a usable close action for persistent notices; keep essential errors and actions in the page too.
Can I change the design or supply my own content?
Yes. Override CSS variables, add classes, or render your own DOM with toast.custom. The render callback receives the toast id and a dismiss() helper, and can return a cleanup function for its listeners.
Does each component need its own toaster?
No. Mount one toaster near your application root and call toast() from anywhere. Every component shares the same queue, so there is nothing to pass around.
What accessibility work remains with my app?
Notify supplies a polite live list, keyboard interaction and reduced-motion styles. You still own meaningful messages, contrast, timing, custom controls and testing with the assistive technologies your application supports.
A little feedback goes a long way

Make the next step a clear one.

Try an interaction, then bring it into your application.

Installation, practical guides and the complete API for Notify.

Read the documentation