UIPin
ComponentsIconsIllustrationsMotionTemplatesApps
Boards
UIPin

Free, open-source UI components, icons, illustrations, motion, templates and apps, in one search. Every item links to its source and licence.

UIPin is free. If it saved you time, you can keep it running:

Buy me a coffee
ComponentsIconsIllustrationsMotionTemplatesAppsLibrariesCompareNew this weekMCP for agentsBoardsPrivacy

Components, icons and artwork belong to their authors and are shown under their open-source licences.

8bitcn/8-bit Alert

Feedback & loaders
1 of 7
Compiling

Theme it

Every preview, live

Brand colour

Corner radius

Font

Recolours shadcn’s tokens, Tailwind’s accent colours and colours set in the code. Red, amber and green classes stay, since they usually mean error, warning or success.

7 versions·4 librariesCompare all alerts →

  • 8-bit Alert
  • 8-bit Alert Dialog
  • Alert
  • Alert dialog
  • Alert
  • Alert Dialog
  • SmoothUI

8-bit Alert

A simple 8-bit alert component

npx shadcn@latest add https://www.8bitcn.com/r/alert.json
Open in v0 Docs Repo
Library
8bitcn
License
MIT
Stack
React · Tailwind CSS
Packages
cn
Also adds
alert
Size
107 lines

Code

components/ui/8bit/alert.tsx

import { type VariantProps, cva } from "class-variance-authority";

import { cn } from "@/lib/utils";

import {
  Alert as ShadcnAlert,
  AlertDescription as ShadcnAlertDescription,
  AlertTitle as ShadcnAlertTitle,
} from "@/components/ui/alert";

export const alertVariants = cva("", {
  variants: {
    font: {
      normal: "",
      retro: "retro",
    },
    variant: {
      default: "bg-card text-card-foreground",
      destructive:
        "text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",
    },
  },
  defaultVariants: {
    variant: "default",
  },
});

export interface BitAlertProps
  extends React.ComponentProps<"div">,
    VariantProps<typeof alertVariants> {}

function Alert({ children, className, font, variant, ...props }: BitAlertProps) {
  return (
    <div className="relative">
      <ShadcnAlert
        {...props}
        variant={variant}
        className={cn(
          "relative rounded-none border-none bg-background",
          font !== "normal" && "retro",
          className
        )}
      >
        {children}
      </ShadcnAlert>

      <div className="absolute -top-1.5 w-1/2 left-1.5 h-1.5 bg-foreground dark:bg-ring" />
      <div className="absolute -top-1.5 w-1/2 right-1.5 h-1.5 bg-foreground dark:bg-ring" />
      <div className="absolute -bottom-1.5 w-1/2 left-1.5 h-1.5 bg-foreground dark:bg-ring" />
      <div className="absolute -bottom-1.5 w-1/2 right-1.5 h-1.5 bg-foreground dark:bg-ring" />
      <div className="absolute top-0 left-0 size-1.5 bg-foreground dark:bg-ring" />
      <div className="absolute top-0 right-0 size-1.5 bg-foreground dark:bg-ring" />
      <div className="absolute bottom-0 left-0 size-1.5 bg-foreground dark:bg-ring" />
      <div className="absolute bottom-0 right-0 size-1.5 bg-foreground dark:bg-ring" />
      <div className="absolute top-1.5 -left-1.5 h-1/2 w-1.5 bg-foreground dark:bg-ring" />
      <div className="absolute bottom-1.5 -left-1.5 h-1/2 w-1.5 bg-foreground dark:bg-ring" />
      <div className="absolute top-1.5 -right-1.5 h-1/2 w-1.5 bg-foreground dark:bg-ring" />
      <div className="absolute bottom-1.5 -right-1.5 h-1/2 w-1.5 bg-foreground dark:bg-ring" />
    </div>
  );
}

function AlertTitle({
  className,
  ...props
}: React.HTMLAttributes<HTMLDivElement>) {
  return (
    <ShadcnAlertTitle
      className={cn("line-clamp-1 font-medium tracking-tight", className)}
      {...props}
    />
  );
}

function AlertDescription({
  className,
  ...props
}: React.HTMLAttributes<HTMLDivElement>) {
  return (
    <ShadcnAlertDescription
      className={cn(
        "text-muted-foreground grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",
        className
      )}
      {...props}
    />
  );
}

export { Alert, AlertTitle, AlertDescription };

More like this

Input Otp

shadcn/ui·Inputs & forms

8-bit Switch

8bitcn·Inputs & forms

Side Panel

Cult UI·Other

8-bit Slider

8bitcn·Inputs & forms

8-bit Health Bar

8bitcn·Feedback & loaders

8-bit Mana Bar

8bitcn·Feedback & loaders

8-bit Progress

8bitcn·Feedback & loaders

8-bit Checkbox

8bitcn·Inputs & forms

8-bit Avatar

8bitcn·Media & 3D

Slider

shadcn/ui·Inputs & forms

Progress

shadcn/ui·Feedback & loaders

Carousel

HextaUI·Media & 3D

Holo Card

React Bits·CardsMIT+

Toolbar Expandable

Motion Primitives·Navigation

Skeleton

shadcn/ui·Feedback & loaders