Toast shows a brief, non-blocking notification to confirm an action or present temporary information; show one with `const showToast = useToast()`, which needs no provider or mounted ToastViewport: inside LayerProvider (or a ToastViewport) it uses that viewport, and otherwise the first toast mounts a fallback viewport on document.body with a development warning. Use it for scenarios where the user needs feedback but not a decision, such as saving, deleting, or changing a status. For production use, prefer the `useToast()` hook; it handles positioning, stacking, auto-dismiss, and deduplication via `ToastViewport`. Only the viewport announces a toast: a `Toast` rendered on its own, as in a preview, is not a live region and announces nothing. Toasts stay within viewport and safe-area gutters, wrap long message content, and enter, exit, or swipe-dismiss toward their configured top or bottom edge. The vertical swipe uses the same spatial model as placement motion: top Toasts leave upward and bottom Toasts leave downward. Swipe waits for dominant edge-directed intent before cancelling native touch movement and reports the existing manual dismissal reason. Pen is supported as direct-contact input; mouse drag is excluded to avoid conflicting with desktop text selection, where the visible close control remains available. Set `isAutoHide: false` explicitly when an action or message must remain available. The `Toast` component renders the visual toast element inline and is useful for previews, documentation, and static showcases where the viewport lifecycle is not needed. Host `data-*` attributes on `Toast` reach the toast element; its role, live-region attributes, and theme attributes stay component-owned. Astryx by Meta. Source: https://astryx.atmeta.com/components/Toast
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Astryx Toast to your project and fits it to your theme.
Code
How Astryx Toast is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
'use client';
/* Copyright (c) 2026 Meta Platforms, Inc. See MIT notice in astryx-toast.tsx. */
import '@/components/ui/astryx-toast-utils/astryx-preview.css';
import {useState} from 'react';
import {Toast} from '@/components/ui/astryx-toast';
import {Button} from '@astryxdesign/core/Button';
import {VStack} from '@astryxdesign/core/Layout';
function OfficialSample() {
const [isShown, setIsShown] = useState(false);
return (
<VStack gap={3} hAlign="center" width="100%" style={{minWidth: 0}}>
<Button label="Show toast" onClick={() => setIsShown(true)} />
{isShown && (
<div style={{display: 'flex', justifyContent: 'center', width: '100%', minWidth: 0}}>
<Toast
type="info"
body="Document saved successfully"
isAutoHide={false}
autoHideDuration={5000}
isExiting={false}
onDismiss={() => setIsShown(false)}
/>
</div>
)}
</VStack>
);
}
export default function Demo() {
return (
<div className="astryx-demo" data-astryx-theme="neutral" data-theme="light">
<div className="astryx-demo-content" data-centered style={{maxWidth: 390}}>
<OfficialSample />
</div>
</div>
);
}







