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.
The preview runs the React version. On iOS 26 and later, the React Native version uses the system’s own glass. See it on a phone.
Installation
For React 19+ apps with Tailwind CSS 4.
npx shadcn@4.14.1 add @glassyui/glass-toastAdds 12 files to components/glassyui and installs @radix-ui/react-toast and clsx.
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>
);
}import { useState } from 'react';
import { GlassButton } from '@/components/glassyui/glass-button';
import {
GlassToast,
GlassToastAction,
GlassToastDescription,
GlassToastProvider,
GlassToastTitle,
GlassToastViewport,
} from '@/components/glassyui/glass-toast';
// Mount the provider and the viewport once, near the root of your app; toasts declared
// anywhere under the provider appear in the viewport.
export default function ToastExample() {
const [open, setOpen] = useState(false);
return (
<GlassToastProvider>
<GlassButton onPress={() => setOpen(true)}>Archive</GlassButton>
<GlassToast onOpenChange={setOpen} open={open}>
<GlassToastTitle>Message archived</GlassToastTitle>
<GlassToastDescription>You can find it in Archive.</GlassToastDescription>
<GlassToastAction altText="Restore the message" onPress={() => setOpen(false)}>
Undo
</GlassToastAction>
</GlassToast>
<GlassToastViewport />
</GlassToastProvider>
);
}
It also uses Glass Button. Install them together:
npx shadcn@4.14.1 add @glassyui-native/glass-toast @glassyui-native/glass-button && npx expo install --fixExamples
<GlassToast>
<GlassToastTitle>Saved</GlassToastTitle>
<GlassToastDescription>Your changes are stored.</GlassToastDescription>
<GlassToastClose />
</GlassToast><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.
| Prop | Type | Default | Description |
|---|---|---|---|
duration | number | 5000 | Milliseconds 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. |
label | string | 'Notification' | Prefix screen readers announce before each toast. |
Also accepts Radix Toast.Provider props.
GlassToast
One toast on a glass card.
| Prop | Type | Default | Description |
|---|---|---|---|
open / defaultOpen | boolean | true | Controlled or uncontrolled open state; an uncontrolled toast shows when it mounts. |
onOpenChange | (open: boolean) => void | None | Called when the toast opens, times out or is dismissed. |
duration | number | provider duration | Overrides the provider's duration for this toast. |
className | string | None | Applies 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.
| Prop | Type | Default | Description |
|---|---|---|---|
altTextRequired | string | None | Tells 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 ×.
| Prop | Type | Default | Description |
|---|---|---|---|
aria-label | string | 'Dismiss' | The button's name. The default applies only without children; with children, their text names it. |
children | ReactNode | × icon | Replaces 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.
| Prop | Type | Default | Description |
|---|---|---|---|
hotkey | string[] | ['F8'] | Keys that move focus to the viewport. |
Also accepts Radix Toast.Viewport props.
The React Native props and exports are in the component’s source.