shadimage
pixelact-ui
componentbadgesource: ok · hit

Pixelact Badge

A simple badge component.

npx shadcn add "https://pixelactui.com/r/badge.json"
free

Visual style

retro

Tags auto-generated by rules on 9/24/2026 — empty means no evidence, not lack of support.

Dependencies

Bundle weight · light

Registry dependencies

badge

Files2 · source cached 10/14/2026, 12:00:01 PM

components/ui/pixelact-ui/badge.tsx
import { type VariantProps, cva } from "class-variance-authority";
import { cn } from "@/lib/utils";
import { Badge as ShadcnBadge } from "@/components/ui/badge";

const badgeVariants = cva("border-none", {
  variants: {
    font: {
      normal: "",
      pixel: "pixel-font",
    },
    variant: {
      default: "bg-primary",
      destructive: "bg-destructive",
      outline: "bg-background",
      secondary: "bg-secondary",
    },
  },
  defaultVariants: {
    font: "pixel",
    variant: "default",
  },
});

export interface BadgeProps
  extends React.ButtonHTMLAttributes<HTMLButtonElement>,
    VariantProps<typeof badgeVariants> {
  asChild?: boolean;
}

function Badge({ children, font, variant, ...props }: BadgeProps) {
  return (
    <div className={cn("relative inline-flex")}>
      <ShadcnBadge
        {...props}
        className={cn(
          "rounded-none shadow-(--pixel-box-shadow) box-shadow-margin",
          badgeVariants({ variant, font })
        )}
        variant={variant}
      >
        {children}
      </ShadcnBadge>
    </div>
  );
}

export { Badge };
components/ui/pixelact-ui/styles/styles.css
@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap");

:root {
  --box-shadow-width: 4px;
  --pixel-box-shadow: calc(-1 * (var(--box-shadow-width))) 0 0 0 black,
    var(--box-shadow-width) 0 0 0 black, 0 var(--box-shadow-width) 0 0 black,
    0 calc(-1 * (var(--box-shadow-width))) 0 0 black;
  --pixel-box-shadow-destructive: calc(-1 * (var(--box-shadow-width))) 0 0 0
      var(--destructive),
    var(--box-shadow-width) 0 0 0 var(--destructive),
    0 var(--box-shadow-width) 0 0 var(--destructive),
    0 calc(-1 * (var(--box-shadow-width))) 0 0 var(--destructive);
  --default-inner-border-color: rgb(200, 200, 200);
}

.dark {
  --pixel-box-shadow: calc(-1 * (var(--box-shadow-width))) 0 0 0 var(--ring),
    var(--box-shadow-width) 0 0 0 var(--ring),
    0 var(--box-shadow-width) 0 0 var(--ring),
    0 calc(-1 * (var(--box-shadow-width))) 0 0 var(--ring);
}

.pixel-font {
  font-family: "Press Start 2P", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  letter-spacing: 0.5px;
}

.box-shadow-margin {
  margin: var(--box-shadow-width);
}

More from pixelact-ui

Browse all components in this library →