Code
In context
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.
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:
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
| Name | Type | Default | Description |
|---|---|---|---|
| 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 | number | 3 | Toasts visible in the collapsed stack; older ones wait behind and appear when it fans out. |
| contained | boolean | off | Sits inside the nearest positioned parent instead of the viewport. |
| theme | 'light' | 'dark' | 'light' | White or dark glass. |
| sound | boolean | off | A 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
- Glass Sheet
- Glass Tip
- Glass Menu
- Tide Slide
- Pearl Code
- Ink Sphere
- Frost Card
- Holo Card
- Stream Text
- Lens Compare
- Pearl Dial
- Nova Rating
- Pearl Check
- Pearl Input
- Pearl Select
- Pearl Accordion
- Pearl Calendar
- Glass Nav
- Pearl Tabs
- Glass Command
- Halo Avatar
- Pearl Steps
- Pearl Skeleton
- Pearl Table
- Pearl Chip
- Pearl Empty
- Roll Counter
- Glass Marquee
- Reveal Text
- Mesh Gradient
- Silk Waves
- Dot Field
- Plasma Orb
- Voice Wave
- Plush Buddy
- Gummy Agent
- Glass Tabbar
- Pearl Pricing
- Glass Bento
- Quote Wall
- Glass Cta
- Magnet Button
- Beam Border
- Spotlight Card
- Scratch Reveal
- Glass Sidebar
- Pearl Pagination
- Pearl Breadcrumb
- Glass Dock
- Pearl Slider
- Pearl Segmented
- Liquid Metal Button
- Mercury Orb
- Prompt Input
- Voice Orb
- Aurora Ring
- Glass Toggle
- Firefly Button
- Pearl Button
- Pearl Loader
- Alien Face
- Prism Button
- Liquid Carousel
- Orbit Carousel
- Deck Carousel