toast
shipbase-ui/toastFreeComponent
shipbase/ui publishes no description for this item.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/shipbase/ui/next/apps/www/public/r/react/toast.jsonSource
1"use client"23import * as React from "react"45import {6 Toast as ToastPrimitive,7 Toaster as ToasterPrimitive,8 createToaster,9} from "@ark-ui/react/toast"10import { type VariantProps, cva } from "class-variance-authority"11import { X } from "lucide-react"1213import { cn } from "@/lib/utils"1415const toastVariants = cva(16 "group z-[--z-index] flex h-[--height] w-full scale-[--scale] items-center justify-between space-x-4 rounded-md border bg-background p-6 pr-8 opacity-[--opacity] shadow-lg transition-all will-change-[translate,opacity,scale] [translate:var(--x)_var(--y)_0] data-[state=open]:animate-in data-[state=closed]: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",17 {18 variants: {19 variant: {20 default: "border bg-background text-foreground",21 destructive:22 "destructive group border-destructive bg-destructive text-destructive-foreground",23 },24 },25 defaultVariants: {26 variant: "default",27 },28 }29)3031const Toaster = React.forwardRef<32 React.ElementRef<typeof ToasterPrimitive>,33 React.ComponentPropsWithoutRef<typeof ToasterPrimitive>34>(({ ...props }, ref) => (35 <ToasterPrimitive36 ref={ref}37 className="max-h-screen w-[calc(100%-var(--gap)*4)] flex-col-reverse p-4 sm:flex-col md:max-w-[420px]"38 {...props}39 />40))41Toaster.displayName = "Toaster"4243const Toast = React.forwardRef<44 React.ElementRef<typeof ToastPrimitive.Root>,45 ToastPrimitive.RootProps & VariantProps<typeof toastVariants>46>(({ className, variant, ...props }, ref) => (47 <ToastPrimitive.Root48 ref={ref}49 className={cn(toastVariants({ variant }), className)}50 {...props}51 />52))53Toast.displayName = "Toast"5455const ToastTitle = React.forwardRef<56 React.ElementRef<typeof ToastPrimitive.Title>,57 ToastPrimitive.TitleProps58>(({ className, ...props }, ref) => (59 <ToastPrimitive.Title60 ref={ref}61 className={cn("font-semibold text-sm", className)}62 {...props}63 />64))65ToastTitle.displayName = "ToastTitle"6667const ToastDescription = React.forwardRef<68 React.ElementRef<typeof ToastPrimitive.Description>,69 ToastPrimitive.DescriptionProps70>(({ className, ...props }, ref) => (71 <ToastPrimitive.Description72 ref={ref}73 className={cn("text-sm opacity-90", className)}74 {...props}75 />76))77ToastDescription.displayName = "ToastDescription"7879const ToastActionTrigger = React.forwardRef<80// … truncated
What it pulls in
npm packages
Files it writes
More from shipbase/ui
All 32 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | shipbase/ui | Components | Free | 2 deps | |
| avataravatar | shipbase/ui | Components | Free | 1 dep | |
| badgebadge | shipbase/ui | Components | Free | 2 deps | |
| buttonbutton | shipbase/ui | Components | Free | 2 deps | |
| cardcard | shipbase/ui | Components | Free | 1 dep | |
| checkboxcheckbox | shipbase/ui | Components | Free | 2 deps | |
| collapsiblecollapsible | shipbase/ui | Components | Free | 1 dep | |
| comboboxcombobox | shipbase/ui | Components | Free | 2 deps |
