Toast
A non-intrusive notification message that appears temporarily to provide feedback about an action, with support for multiple variants and auto-dismiss.
Preview
Usage
tsx
import { useToast } from "zostel-ui";
function BookingButton() {
const { toast } = useToast();
return (
<Button
onClick={() => {
toast({
title: "Booking Confirmed",
description: "Your stay has been confirmed.",
variant: "default",
});
}}
>
Book Now
</Button>
);
}
// Variants: "default" | "success" | "destructive"Props
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | — | The title text of the toast notification |
description | string | — | The description text below the title |
variant | "default" | "success" | "destructive" | "default" | The visual style variant of the toast |
duration | number | 4000 | Duration in milliseconds before the toast auto-dismisses |
action | ReactNode | — | An optional action button rendered inside the toast |
titleType:
stringDefault: —
The title text of the toast notification
descriptionType:
stringDefault: —
The description text below the title
variantType:
"default" | "success" | "destructive"Default: "default"
The visual style variant of the toast
durationType:
numberDefault: 4000
Duration in milliseconds before the toast auto-dismisses
actionType:
ReactNodeDefault: —
An optional action button rendered inside the toast