1. Changes saved
  2. Invite sent to Mira
    She has 7 days to accept.

Code

<!-- glass-toast.free.js: download it from the Install section below and host it with your site -->
<script src="/glass-toast.free.js" defer></script>

<!-- once per page -->
<glass-toast position="bottom-center" theme="light"></glass-toast>

<script>
  const toaster = document.querySelector('glass-toast');

  toaster.show({ title: 'Changes saved', kind: 'success' });
  toaster.show({ title: 'Project archived', action: 'Undo', duration: 6000 });

  // loading → done: show again with the same id
  const id = toaster.show({ title: 'Uploading…', kind: 'loading' });
  toaster.show({ id, title: 'Upload complete', kind: 'success' });

  toaster.addEventListener('action', (e) => console.log('undo', e.detail.id));
</script>

In context

  1. Changes saved
  2. Invite sent to Mira
    She has 7 days to accept.
In the top right corner
  1. Changes saved
  2. Invite sent to Mira
    She has 7 days to accept.
Mint Pro

Install · Free Web Component

One file, no dependencies. Aurora preset, every other option included. Host it yourself so your visitors never load anything from our servers.

1. Install with one command — or download the file
shadcn CLI · React
npx shadcn@latest add https://www.ui-design.co/r/glass-toast.json
2. Load it and use the element
HTML
<!-- glass-toast.free.js: download it from the Install section below and host it with your site -->
<script src="/glass-toast.free.js" defer></script>

<!-- once per page -->
<glass-toast position="bottom-right" theme="light"></glass-toast>

<script>
  const toaster = document.querySelector('glass-toast');

  toaster.show({ title: 'Changes saved', kind: 'success' });
  toaster.show({ title: 'Project archived', action: 'Undo', duration: 6000 });

  // loading → done: show again with the same id
  const id = toaster.show({ title: 'Uploading…', kind: 'loading' });
  toaster.show({ id, title: 'Upload complete', kind: 'success' });

  toaster.addEventListener('action', (e) => console.log('undo', e.detail.id));
</script>
3. React + TypeScript (optional)

The shadcn command adds a typed React wrapper for you. Using the file directly? Custom elements work in React as-is; for type checking add:

TypeScript
// glass-toast.d.ts
declare namespace JSX {
  interface IntrinsicElements {
    'glass-toast': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
      position?: 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
      max?: number | string;
      contained?: boolean | '';
      theme?: 'light' | 'dark';
      sound?: boolean | '';
    };
  }
}

Pro · React + TypeScript Pro

One payment of $4.99, yours forever. Use it in unlimited personal and commercial projects; no resale.

  • React component and a toast() helper you can call from anywhere, with TypeScript types and the full source
  • Sunset, Mint and Mono tints, plus custom tints from Brand Fit
  • The vanilla Web Component with every tint, a demo page, README and license

Attributes & props

NameTypeDefaultDescription
show({ … }) method—title, description, kind (info | success | error | loading), duration in ms (default 4000; 0 stays until dismissed; loading stays), action (button label), id. Returns the id; showing again with the same id updates that toast in place.
dismiss(id?) method—Removes one toast, or all of them without an id.
position 'top-left' … 'bottom-right''bottom-right'Corner or centre of the screen the stack lives in.
max number3Toasts visible in the collapsed stack; older ones wait behind and appear when it fans out.
contained booleanoffSits inside the nearest positioned parent instead of the viewport.
theme 'light' | 'dark''light'White or dark glass.
sound booleanoffA glass clink as a toast arrives. Also on for everything inside an element with data-ui-sound="on".
tint Pro'aurora' | 'sunset' | 'mint' | 'mono' | object'aurora'Colours of the timer light and the info icon, or a custom tint. Free build ships Aurora only.

Without a reference to the element you can also fire window.dispatchEvent(new CustomEvent('glass-toast', { detail: { title: 'Saved' } })) from anywhere. The timer pauses while the pointer is over the stack or the tab is hidden. The list is an aria-live region, errors are announced as alerts, the buttons are reachable with Tab and Escape dismisses the focused toast. It fires dismiss and action with detail.id. The glass needs something behind it to blur — it looks best over content, not an empty white page.

More components