Components
Notification system driven by the useToast hook (show/hide) and ToastProvider for scoped render regions. Toasts support an icon, title, text and 1-2 actions, five colors (inverted default plus neutral/primary/positive/critical), configurable position, timeout and width, vertical action layout, a custom startSlot and fully custom children layouts for banners.
npx @21st-dev/cli add reshaped/reshaped-toastLoading preview...
import { Button, Reshaped } from "reshaped/bundle";
import { useToast } from "@/components/ui/reshaped-toast";
const CheckCheckIcon = () => (
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<path d="M18 6 7 17l-5-5" />
<path d="m22 10-7.5 7.5L13 16" />
</svg>
);
function Trigger() {
const toast = useToast();
return (
<Button
onClick={() => {
const id = toast.show({
text: "Notification sent",
icon: CheckCheckIcon,
actionsSlot: <Button onClick={() => toast.hide(id)}>Undo</Button>,
color: "positive",
timeout: 0,
});
}}
>
Show notification
</Button>
);
}
export default function Demo() {
return (
<Reshaped theme="slate">
<div style={{ minHeight: 420, display: "flex", alignItems: "center", justifyContent: "center", padding: 24 }}>
<Trigger />
</div>
</Reshaped>
);
}
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...