Browse docsToast

Feedback

Glass Toast

A glass notification for brief updates that screen readers announce.

Requires a GlassToastProvider around your toasts and one GlassToastViewport.

Preview

Demos ready. Update 0.

Installation

For React 19+ apps with Tailwind CSS 4.

npx shadcn@4.14.1 add @glassyui/glass-toast

Adds 12 files to components/glassyui and installs @radix-ui/react-toast and clsx.

Usage

Usage

import { GlassToast, GlassToastDescription, GlassToastProvider, GlassToastTitle, GlassToastViewport } from "@/components/glassyui/glass-toast";

export function ToastDemo() {
  return (
    <GlassToastProvider>
      <GlassToast open>
        <GlassToastTitle>Saved</GlassToastTitle>
        <GlassToastDescription>Your changes are stored.</GlassToastDescription>
      </GlassToast>
      <GlassToastViewport />
    </GlassToastProvider>
  );
}

Examples

A dismiss button

<GlassToast>
  <GlassToastTitle>Saved</GlassToastTitle>
  <GlassToastDescription>Your changes are stored.</GlassToastDescription>
  <GlassToastClose />
</GlassToast>
An action

<GlassToast>
  <GlassToastTitle>Message deleted</GlassToastTitle>
  <GlassToastAction altText="Undo the delete" onClick={undo}>
    Undo
  </GlassToastAction>
</GlassToast>

API reference

GlassToastProvider

Holds the toasts and their shared settings. Wrap your toasts and the viewport in it.

PropTypeDefaultDescription
durationnumber5000Milliseconds before a toast closes on its own.
swipeDirection'right' | 'left' | 'up' | 'down''right'The way a swipe dismisses a toast; toasts also slide in from and out to this side.
labelstring'Notification'Prefix screen readers announce before each toast.

Also accepts Radix Toast.Provider props.

GlassToast

One toast on a glass card.

PropTypeDefaultDescription
open / defaultOpenbooleantrueControlled or uncontrolled open state; an uncontrolled toast shows when it mounts.
onOpenChange(open: boolean) => voidNoneCalled when the toast opens, times out or is dismissed.
durationnumberprovider durationOverrides the provider's duration for this toast.
classNamestringNoneApplies to the outer list item, not the glass card inside it.

Also accepts Radix Toast.Root props.

GlassToastTitle / GlassToastDescription

The heading and the message text.

Also accepts Radix Toast.Title and Toast.Description props.

GlassToastAction

A pill button under the message, such as Undo.

PropTypeDefaultDescription
altTextRequiredstringNoneTells screen reader users how to do the action without the button.

Also accepts Radix Toast.Action props.

GlassToastClose

A round dismiss button that draws its own ×.

PropTypeDefaultDescription
aria-labelstring'Dismiss'The button's name. The default applies only without children; with children, their text names it.
childrenReactNode× iconReplaces the × icon.

Also accepts Radix Toast.Close props.

GlassToastViewport

The fixed list at the top right where toasts appear, portalled to document.body after hydration.

PropTypeDefaultDescription
hotkeystring[]['F8']Keys that move focus to the viewport.

Also accepts Radix Toast.Viewport props.