alert
nrjdalal/alertFreeComponent
acme publishes no description for this item.
Install it
npx shadcn@latest add https://nrjdalal.dev/r/alert.jsonSource
1import { cn } from "@/lib/utils"2import { cva, type VariantProps } from "class-variance-authority"3import * as React from "react"45const alertVariants = cva(6 "relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",7 {8 variants: {9 variant: {10 default: "bg-background text-foreground",11 destructive:12 "text-destructive-foreground [&>svg]:text-current *:data-[slot=alert-description]:text-destructive-foreground/80",13 },14 },15 defaultVariants: {16 variant: "default",17 },18 },19)2021function Alert({22 className,23 variant,24 ...props25}: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {26 return (27 <div28 data-slot="alert"29 role="alert"30 className={cn(alertVariants({ variant }), className)}31 {...props}32 />33 )34}3536function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {37 return (38 <div39 data-slot="alert-title"40 className={cn(41 "col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",42 className,43 )}44 {...props}45 />46 )47}4849function AlertDescription({50 className,51 ...props52}: React.ComponentProps<"div">) {53 return (54 <div55 data-slot="alert-description"56 className={cn(57 "text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",58 className,59 )}60 {...props}61 />62 )63}6465export { Alert, AlertTitle, AlertDescription }
What it pulls in
npm packages
Files it writes
More from acme
All 49 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | acme | Components | Free | 5 deps · 2 files | |
| alert-dialogalert-dialog | acme | Components | Free | 6 deps · 3 files | |
| aspect-ratioaspect-ratio | acme | Components | Free | 1 dep | |
| avataravatar | acme | Components | Free | 4 deps · 2 files | |
| badgebadge | acme | Components | Free | 5 deps · 2 files | |
| breadcrumbbreadcrumb | acme | Components | Free | 5 deps · 2 files | |
| buttonbutton | acme | Components | Free | 5 deps · 2 files | |
| calendarcalendar | acme | Components | Free | 7 deps · 3 files |
