Alert
gymnopedies/alertFreeComponent
Alert — gymnopédies-themed shadcn primitive.
Install it
npx shadcn@latest add https://gymnopedies.shoota.work/r/alert.jsonSource
1import * as React from "react"2import { cva, type VariantProps } from "class-variance-authority"34import { cn } from "@/lib/utils"56const alertVariants = cva(7 "group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",8 {9 variants: {10 variant: {11 default: "bg-card text-card-foreground",12 destructive:13 "bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current",14 },15 },16 defaultVariants: {17 variant: "default",18 },19 }20)2122function Alert({23 className,24 variant,25 ...props26}: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {27 return (28 <div29 data-slot="alert"30 role="alert"31 className={cn(alertVariants({ variant }), className)}32 {...props}33 />34 )35}3637function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {38 return (39 <div40 data-slot="alert-title"41 className={cn(42 "font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",43 className44 )}45 {...props}46 />47 )48}4950function AlertDescription({51 className,52 ...props53}: React.ComponentProps<"div">) {54 return (55 <div56 data-slot="alert-description"57 className={cn(58 "text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",59 className60 )}61 {...props}62 />63 )64}6566function AlertAction({ className, ...props }: React.ComponentProps<"div">) {67 return (68 <div69 data-slot="alert-action"70 className={cn("absolute top-2 right-2", className)}71 {...props}72 />73 )74}7576export { Alert, AlertTitle, AlertDescription, AlertAction }
What it pulls in
npm packages
Other registry items
Files it writes
More from gymnopedies
All 49 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | gymnopedies | Components | Free | 2 deps | |
| Alert Dialogalert-dialog | gymnopedies | Components | Free | 1 dep | |
| Articlearticle | gymnopedies | Components | Free | no deps | |
| Aspect Ratioaspect-ratio | gymnopedies | Components | Free | no deps | |
| Avataravatar | gymnopedies | Components | Free | 1 dep | |
| Badgebadge | gymnopedies | Components | Free | 2 deps | |
| Breadcrumbbreadcrumb | gymnopedies | Components | Free | 2 deps | |
| Buttonbutton | gymnopedies | Components | Free | 2 deps |
