Toast

This is a Toast component.

Installation

1. Dependencies

npm install clsx tailwind-merge framer-motion

2. Paste inside @/lib/utils.ts

import { clsx } from "clsx";
import { twMerge } from "tailwind-merge";

export function cn(...inputs: Parameters<typeof clsx>) {
  return twMerge(clsx(...inputs));
}

3. Copy Toast Code

Loading...

Copy Toast Code

Toast Props

NameTypeRequiredDefaultDescription
messagestringYesundefinedThe message to display in the toast.
isOpenbooleanYesundefinedWhether the toast is open or not.
onClose() => voidYesundefinedFunction to call when the toast is closed.
durationnumberNo3000Duration in milliseconds before the toast closes automatically.
type"success" | "error" | "info" | "warning" | "default"No"default"Type of the toast (success, error, info, warning, default).
classNamestringNo""Additional class names for styling.