toast
showcase-elevenlabs/toastFreeComponent
shadcn/ui publishes no description for this item.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/elevenlabs/showcase/main/apps/www/public/r/styles/new-york/toast.jsonSource
1"use client"23import * as React from "react"4import * as ToastPrimitives from "@radix-ui/react-toast"5import { cva, type VariantProps } from "class-variance-authority"6import { X } from "lucide-react"78import { cn } from "@/lib/utils"910const ToastProvider = ToastPrimitives.Provider1112const ToastViewport = React.forwardRef<13 React.ElementRef<typeof ToastPrimitives.Viewport>,14 React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>15>(({ className, ...props }, ref) => (16 <ToastPrimitives.Viewport17 ref={ref}18 className={cn(19 "fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",20 className21 )}22 {...props}23 />24))25ToastViewport.displayName = ToastPrimitives.Viewport.displayName2627const toastVariants = cva(28 "group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",29 {30 variants: {31 variant: {32 default: "border bg-background text-foreground",33 destructive:34 "destructive group border-destructive bg-destructive text-destructive-foreground",35 },36 },37 defaultVariants: {38 variant: "default",39 },40 }41)4243const Toast = React.forwardRef<44 React.ElementRef<typeof ToastPrimitives.Root>,45 React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &46 VariantProps<typeof toastVariants>47>(({ className, variant, ...props }, ref) => {48 return (49 <ToastPrimitives.Root50 ref={ref}51 className={cn(toastVariants({ variant }), className)}52 {...props}53 />54 )55})56Toast.displayName = ToastPrimitives.Root.displayName5758const ToastAction = React.forwardRef<59 React.ElementRef<typeof ToastPrimitives.Action>,60 React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>61>(({ className, ...props }, ref) => (62 <ToastPrimitives.Action63 ref={ref}64 className={cn(65// … truncated
What it pulls in
npm packages
Files it writes
More from shadcn/ui
All 357 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | shadcn/ui | Components | Free | 1 dep | |
| alertalert | shadcn/ui | Components | Free | no deps | |
| alert-dialogalert-dialog | shadcn/ui | Components | Free | 1 dep | |
| aspect-ratioaspect-ratio | shadcn/ui | Components | Free | 1 dep | |
| avataravatar | shadcn/ui | Components | Free | 1 dep | |
| badgebadge | shadcn/ui | Components | Free | 1 dep | |
| breadcrumbbreadcrumb | shadcn/ui | Components | Free | 1 dep | |
| buttonbutton | shadcn/ui | Components | Free | 1 dep |
