8-bit Alert
8bitcn/alertFreeComponent
A simple 8-bit switch component
Install it
npx shadcn@latest add https://www.8bitcn.com/r/alert.jsonSource
1import { type VariantProps, cva } from "class-variance-authority";23import { cn } from "@/lib/utils";45import {6 Alert as ShadcnAlert,7 AlertDescription as ShadcnAlertDescription,8 AlertTitle as ShadcnAlertTitle,9} from "@/components/ui/alert";1011export const alertVariants = cva("", {12 variants: {13 font: {14 normal: "",15 retro: "retro",16 },17 variant: {18 default: "bg-card text-card-foreground",19 destructive:20 "text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",21 },22 },23 defaultVariants: {24 variant: "default",25 },26});2728export interface BitAlertProps29 extends React.ComponentProps<"div">,30 VariantProps<typeof alertVariants> {}3132function Alert({ children, className, font, variant, ...props }: BitAlertProps) {33 return (34 <div className="relative">35 <ShadcnAlert36 {...props}37 variant={variant}38 className={cn(39 "relative rounded-none border-none bg-background",40 font !== "normal" && "retro",41 className42 )}43 >44 {children}45 </ShadcnAlert>4647 <div className="absolute -top-1.5 w-1/2 left-1.5 h-1.5 bg-foreground dark:bg-ring" />48 <div className="absolute -top-1.5 w-1/2 right-1.5 h-1.5 bg-foreground dark:bg-ring" />49 <div className="absolute -bottom-1.5 w-1/2 left-1.5 h-1.5 bg-foreground dark:bg-ring" />50 <div className="absolute -bottom-1.5 w-1/2 right-1.5 h-1.5 bg-foreground dark:bg-ring" />51 <div className="absolute top-0 left-0 size-1.5 bg-foreground dark:bg-ring" />52 <div className="absolute top-0 right-0 size-1.5 bg-foreground dark:bg-ring" />53 <div className="absolute bottom-0 left-0 size-1.5 bg-foreground dark:bg-ring" />54 <div className="absolute bottom-0 right-0 size-1.5 bg-foreground dark:bg-ring" />55 <div className="absolute top-1.5 -left-1.5 h-1/2 w-1.5 bg-foreground dark:bg-ring" />56 <div className="absolute bottom-1.5 -left-1.5 h-1/2 w-1.5 bg-foreground dark:bg-ring" />57 <div className="absolute top-1.5 -right-1.5 h-1/2 w-1.5 bg-foreground dark:bg-ring" />58 <div className="absolute bottom-1.5 -right-1.5 h-1/2 w-1.5 bg-foreground dark:bg-ring" />59 </div>60 );61}6263function AlertTitle({64 className,65 ...props66}: React.HTMLAttributes<HTMLDivElement>) {67 return (68 <ShadcnAlertTitle69 className={cn("line-clamp-1 font-medium tracking-tight", className)}70 {...props}71 />72 );73}7475function AlertDescription({76// … truncated
What it pulls in
Other registry items
Files it writes
More from 8bitcn
All 121 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| 8-bit Accordionaccordion | 8bitcn | Components | Free | no deps · 2 files | |
| 8-bit Alert Dialogalert-dialog | 8bitcn | Components | Free | no deps · 2 files | |
| 8-bit Avataravatar | 8bitcn | Components | Free | no deps · 2 files | |
| 8-bit Badgebadge | 8bitcn | Components | Free | no deps · 2 files | |
| 8-bit Breadcrumbbreadcrumb | 8bitcn | Components | Free | no deps · 2 files | |
| 8-bit Buttonbutton | 8bitcn | Components | Free | no deps · 2 files | |
| 8-bit Button Groupbutton-group | 8bitcn | Components | Free | no deps · 4 files | |
| 8-bit Calendarcalendar | 8bitcn | Components | Free | no deps · 2 files |
