Componentfeedback1.49 KB gzipZero dependencies
Toast
Transient stacked notices with auto-dismiss.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add toastOr install the full npm package:
npm install bigbulluiUsage
tsx10 lines
import { ToastProvider, useToast } from "@/components/ui/toast"; function Demo() { const { toast } = useToast(); return ( <button onClick={() => toast({ title: "Admitted", description: "Stub #402 accepted." })}> Show Toast </button> );}Source code
toast.tsx + 2 helpersZero third-party dependencies (3 local files shown in tabs below).
tsxtoast.tsx221 lines
"use client"; import * as React from "react";import { createPortal } from "react-dom";import { cn } from "./lib/utils";import { useIsMounted } from "./lib/react-compat"; export type ToastTone = "default" | "accent" | "destructive";export type ToastPosition = "bottom-right" | "bottom-left" | "top-right" | "top-left"; export interface ToastAction { label: string; onClick: () => void;} export interface ToastOptions { title: string; description?: string;Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { useToast } from "@/components/ui/toast"; <useToast />| Prop | Type | Description |
|---|---|---|
| children | React.ReactNode | Child elements rendered inside the component. |
| position | ToastPosition | Configures position. (Default: "bottom-right") |
| maxToasts | number | Configures max toasts. (Default: 5) |