Pixelact Alert
pixelact-ui/alertFreeComponent
A simple alert component.
Live preview
live · rendered by the registry
Rendered by Pixelact UI on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://pixelactui.com/r/alert.jsonSource
1import { type VariantProps, cva } from "class-variance-authority";2import { cn } from "@/lib/utils";3import {4 Alert as ShadcnAlert,5 AlertDescription as ShadcnAlertDescription,6 AlertTitle as ShadcnAlertTitle,7} from "@/components/ui/alert";8import "@/components/ui/pixelact-ui/styles/styles.css";910const alertVariants = cva("", {11 variants: {12 font: {13 normal: "",14 pixel: "pixel-font",15 },16 variant: {17 default: "bg-card text-card-foreground",18 destructive:19 "text-destructive shadow-(--pixel-box-shadow-destructive) bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",20 },21 },22 defaultVariants: {23 variant: "default",24 font: "pixel",25 },26});2728export interface AlertProps29 extends React.ComponentProps<"div">,30 VariantProps<typeof alertVariants> {}3132function Alert({ children, ...props }: AlertProps) {33 const { variant, className, font } = props;3435 return (36 <ShadcnAlert37 {...props}38 className={cn(39 "relative shadow-(--pixel-box-shadow) box-shadow-margin rounded-none border-none bg-background",40 alertVariants({ variant, font }),41 className42 )}43 >44 {children}45 </ShadcnAlert>46 );47}4849function AlertTitle({50 className,51 ...props52}: React.HTMLAttributes<HTMLDivElement>) {53 return (54 <ShadcnAlertTitle55 className={cn(56 "line-clamp-1 text-base underline mb-2 font-medium tracking-tight",57 className58 )}59 {...props}60 />61 );62}6364function AlertDescription({65 className,66 ...props67}: React.HTMLAttributes<HTMLDivElement>) {68 return (69 <ShadcnAlertDescription70 className={cn(71 "grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",72 className73 )}74 {...props}75 />76 );77}7879export { Alert, AlertTitle, AlertDescription };
What it pulls in
Other registry items
Files it writes
More from Pixelact UI
All 28 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Pixelact Accordionaccordion | Pixelact UI | Components | Free | no deps · 2 files | |
| Pixelact Alert Dialogalert-dialog | Pixelact UI | Components | Free | no deps · 2 files | |
| Pixelact Avataravatar | Pixelact UI | Components | Free | no deps · 2 files | |
| Pixelact Badgebadge | Pixelact UI | Components | Free | no deps · 2 files | |
| Pixelact Breadcrumbbreadcrumb | Pixelact UI | Components | Free | no deps · 2 files | |
| Pixelact Buttonbutton | Pixelact UI | Components | Free | no deps · 3 files | |
| Pixelact Calendarcalendar | Pixelact UI | Components | Free | no deps · 2 files | |
| Pixelact Cardcard | Pixelact UI | Components | Free | no deps · 2 files |
