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, Dismissible, Image, Reshaped, Text, View } from "reshaped/bundle";
import { useToast } from "@/components/ui/reshaped-toast";
function Trigger() {
const toast = useToast();
return (
<Button
onClick={() => {
const id = toast.show({
children: (
<View gap={4} direction="row">
<View aspectRatio={1 / 1}>
<Image
height="100px"
src="https://www.reshaped.so/img/examples/architecture-4.webp"
borderRadius="medium"
/>
</View>
<View.Item grow>
<View gap={1}>
<Dismissible
closeAriaLabel="Close notification"
onClose={() => toast.hide(id)}
>
<Text variant="body-1" weight="bold">
Say thanks! π
</Text>
</Dismissible>
<Text variant="body-2">
Give a shoutout to the author on social media or copy the text
below to attribute.
</Text>
<View.Item gapBefore={2}>
<View
padding={2}
borderColor="neutral-faded"
backgroundColor="neutral-faded"
borderRadius="small"
>
Photo by Pierre ChΓ’tel-Innocenti
</View>
</View.Item>
</View>
</View.Item>
</View>
),
color: "neutral",
position: "bottom-start",
timeout: 0,
width: "long",
});
}}
>
Show promotion banner
</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...