Alert
rivelle/alertFreeComponent
A semantic callout for important information.
Live preview
live · rendered by the registry
Rendered by rivelle on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://rivelle.dev/r/alert.jsonSource
1import * as React from "react"2import { cva, type VariantProps } from "class-variance-authority"34import { cn } from "@/lib/utils"56const alertVariants = cva("relative grid w-full grid-cols-[0_1fr] items-start gap-y-1 overflow-hidden rounded-2xl border px-5 py-4 text-sm shadow-[inset_0_1px_0_color-mix(in_oklch,var(--background)_65%,transparent)] before:absolute before:inset-y-3 before:left-0 before:w-0.5 before:rounded-full has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5", { variants: { variant: { default: "border-foreground/10 bg-foreground/[.03] text-card-foreground before:bg-primary [&>svg]:text-primary", destructive: "border-destructive/20 bg-destructive/[.045] text-destructive before:bg-destructive [&>svg]:text-destructive", success: "border-emerald-500/20 bg-emerald-500/[.045] text-emerald-700 before:bg-emerald-500 dark:text-emerald-300" } }, defaultVariants: { variant: "default" } })7function Alert({ className, variant, ...props }: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) { return <div role="alert" data-slot="alert" className={cn(alertVariants({ variant }), className)} {...props} /> }8function AlertTitle({ className, ...props }: React.ComponentProps<"div">) { return <div data-slot="alert-title" className={cn("col-start-2 font-semibold leading-none tracking-[-0.015em]", className)} {...props} /> }9function AlertDescription({ className, ...props }: React.ComponentProps<"div">) { return <div data-slot="alert-description" className={cn("col-start-2 text-sm leading-relaxed text-muted-foreground", className)} {...props} /> }1011export { Alert, AlertDescription, AlertTitle, alertVariants }
What it pulls in
npm packages
Other registry items
Files it writes
More from rivelle
All 83 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | rivelle | Components | Free | 2 deps | |
| Alert Dialogalert-dialog | rivelle | Components | Free | 1 dep | |
| Aspect Ratioaspect-ratio | rivelle | Components | Free | 1 dep | |
| Avataravatar | rivelle | Components | Free | 1 dep | |
| Badgebadge | rivelle | Components | Free | 2 deps | |
| Breadcrumbbreadcrumb | rivelle | Components | Free | 2 deps | |
| Buttonbutton | rivelle | Components | Free | 2 deps | |
| Button Groupbutton-group | rivelle | Components | Free | no deps |
