8bitcn UI
blockadvanced2source: ok · hit
8-bit Advanced 2
KPI metrics dashboard with progress bars.
npx shadcn add "https://www.8bitcn.com/r/advanced2.json"free
Where it goes
statskanbandashboard-shell
Interaction
animated-counter
Use cases
dashboard
Tags auto-generated by rules on 9/24/2026 — empty means no evidence, not lack of support.
Dependencies
Bundle weight · lightRegistry dependencies
badgecardprogress
Files5 · source cached 10/9/2026, 10:18:41 PM
components/ui/8bit/blocks/advanced2.tsx
import type { ReactNode } from "react";
import { cn } from "@/lib/utils";
import {
Card,
CardContent,
CardHeader,
CardTitle,
} from "@/components/ui/8bit/card";
import { Progress } from "@/components/ui/8bit/progress";
import "@/components/ui/8bit/styles/retro.css";
export interface MetricCard {
change?: string;
icon: ReactNode;
progress?: number;
title: string;
value: string;
}
interface Advanced2Props {
className?: string;
description?: string;
metrics?: MetricCard[];
title?: string;
}
const defaultMetrics: MetricCard[] = [
{
icon: "HP",
title: "Active Players",
value: "12,847",
change: "+23% this week",
progress: 78,
},
{
icon: "XP",
title: "Total XP Earned",
value: "4.2M",
change: "+180K today",
},
{
icon: "GP",
title: "Gold Collected",
value: "891K",
change: "+12% this month",
progress: 45,
},
{
icon: "LV",
title: "Avg Player Level",
value: "34",
change: "+2 this week",
progress: 68,
},
];
export default function Advanced2({
title = "Stats Dashboard",
description = "Real-time metrics from the battlefield",
metrics = defaultMetrics,
className,
}: Advanced2Props) {
return (
<section className={cn("w-full px-4 py-16", className)}>
<div className="mx-auto max-w-4xl">
{(title || description) && (
<div className="mb-10 text-center">
{title && (
<h2 className="retro mb-3 font-bold text-2xl tracking-tight md:text-3xl">
{title}
</h2>
)}
{description && (
<p className="retro text-muted-foreground text-[9px]">{description}</p>
)}
</div>
)}
<div className="grid gap-x-4 gap-y-1 sm:grid-cols-2">
{metrics.map((metric) => (
<Card key={metric.title}>
<CardHeader className="pb-2">
<div className="flex items-center justify-between">
<CardTitle className="text-xs text-muted-foreground">
{metric.title}
</CardTitle>
<span className="retro font-bold text-sm">{metric.icon}</span>
</div>
</CardHeader>
<CardContent>
<div className="retro mb-1 font-bold text-2xl">
{metric.value}
</div>
{metric.change && (
<p className="retro mb-2 text-muted-foreground text-[10px]">
{metric.change}
</p>
)}
{metric.progress !== undefined && (
<Progress className="h-2" value={metric.progress} />
)}
</CardContent>
</Card>
))}
</div>
</div>
</section>
);
}
components/ui/8bit/styles/retro.css
@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap");
.retro {
font-family:
"Press Start 2P",
system-ui,
-apple-system,
sans-serif;
line-height: 1.5;
letter-spacing: 0.5px;
}
.pixelated {
image-rendering: pixelated;
image-rendering: crisp-edges;
}components/ui/8bit/badge.tsx
import { type VariantProps, cva } from "class-variance-authority";
import { cn } from "@/lib/utils";
import { Badge as ShadcnBadge } from "@/components/ui/badge";
export const badgeVariants = cva("", {
variants: {
font: {
normal: "",
retro: "retro",
},
variant: {
default: "border-primary bg-primary",
destructive: "border-destructive bg-destructive",
outline: "border-background bg-background",
secondary: "border-secondary bg-secondary",
},
},
defaultVariants: {
variant: "default",
},
});
export interface BitButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof badgeVariants> {
asChild?: boolean;
}
function Badge({
children,
className = "",
font,
variant,
...props
}: BitButtonProps) {
const color = badgeVariants({ variant, font });
const classes = className.split(" ");
// visual classes for badge and sidebars
const visualClasses = classes.filter(
(c) =>
c.startsWith("bg-") ||
c.startsWith("border-") ||
c.startsWith("text-") ||
c.startsWith("rounded-")
);
// Container should accept all non-visual utility classes (e.g., size, spacing, layout)
const containerClasses = classes.filter(
(c) =>
!(
c.startsWith("bg-") ||
c.startsWith("border-") ||
c.startsWith("text-") ||
c.startsWith("rounded-")
)
);
return (
<div className={cn("relative inline-flex items-stretch", containerClasses)}>
<ShadcnBadge
{...props}
className={cn(
"h-full",
"rounded-none",
"w-full",
font !== "normal" && "retro",
visualClasses
)}
variant={variant}
>
{children}
</ShadcnBadge>
{/* Left pixel bar */}
<div
className={cn(
"-left-1.5 absolute inset-y-[4px] w-1.5",
color,
visualClasses
)}
/>
{/* Right pixel bar */}
<div
className={cn(
"-right-1.5 absolute inset-y-[4px] w-1.5",
color,
visualClasses
)}
/>
</div>
);
}
export { Badge };
components/ui/8bit/card.tsx
import { type VariantProps, cva } from "class-variance-authority";
import { cn } from "@/lib/utils";
import {
Card as ShadcnCard,
CardAction as ShadcnCardAction,
CardContent as ShadcnCardContent,
CardDescription as ShadcnCardDescription,
CardFooter as ShadcnCardFooter,
CardHeader as ShadcnCardHeader,
CardTitle as ShadcnCardTitle,
} from "@/components/ui/card";
import "@/components/ui/8bit/styles/retro.css";
export const cardVariants = cva("", {
variants: {
font: {
normal: "",
retro: "retro",
},
},
defaultVariants: {
font: "retro",
},
});
export interface BitCardProps
extends React.ComponentProps<"div">,
VariantProps<typeof cardVariants> {
asChild?: boolean;
}
function Card({ className, font, ...props }: BitCardProps) {
return (
<div
className={cn(
"relative bg-card text-card-foreground border-y-6 border-foreground dark:border-ring p-0!",
className
)}
>
<ShadcnCard
{...props}
className={cn(
"rounded-none border-0 w-full! h-full flex flex-col bg-card text-card-foreground shadow-none",
font !== "normal" && "retro",
className
)}
/>
<div
className={cn("absolute inset-0 border-x-6 -mx-1.5 border-inherit pointer-events-none")}
aria-hidden="true"
/>
</div>
);
}
function CardHeader({ ...props }: BitCardProps) {
const { className, font } = props;
return (
<ShadcnCardHeader
className={cn(font !== "normal" && "retro", className)}
{...props}
/>
);
}
function CardTitle({ ...props }: BitCardProps) {
const { className, font } = props;
return (
<ShadcnCardTitle
className={cn(font !== "normal" && "retro", className)}
{...props}
/>
);
}
function CardDescription({ ...props }: BitCardProps) {
const { className, font } = props;
return (
<ShadcnCardDescription
className={cn(font !== "normal" && "retro", className)}
{...props}
/>
);
}
function CardAction({ ...props }: BitCardProps) {
const { className, font } = props;
return (
<ShadcnCardAction
className={cn(font !== "normal" && "retro", className)}
{...props}
/>
);
}
function CardContent({ ...props }: BitCardProps) {
const { className, font } = props;
return (
<ShadcnCardContent
className={cn("flex-1", font !== "normal" && "retro", className)}
{...props}
/>
);
}
function CardFooter({ ...props }: BitCardProps) {
const { className, font } = props;
return (
<ShadcnCardFooter
data-slot="card-footer"
className={cn(font !== "normal" && "retro", className)}
{...props}
/>
);
}
export {
Card,
CardHeader,
CardFooter,
CardTitle,
CardAction,
CardDescription,
CardContent,
};
components/ui/8bit/progress.tsx
import * as ProgressPrimitive from "@radix-ui/react-progress";
import { type VariantProps, cva } from "class-variance-authority";
import { cn } from "@/lib/utils";
import "@/components/ui/8bit/styles/retro.css";
export const progressVariants = cva("", {
variants: {
variant: {
default: "",
retro: "retro",
},
font: {
normal: "",
retro: "retro",
},
},
defaultVariants: {
font: "retro",
},
});
export interface BitProgressProps
extends React.ComponentProps<typeof ProgressPrimitive.Root>,
VariantProps<typeof progressVariants> {
className?: string;
font?: VariantProps<typeof progressVariants>["font"];
progressBg?: string;
}
function Progress({
className,
font,
variant,
value,
progressBg,
...props
}: BitProgressProps) {
// Extract height from className if present
const heightMatch = className?.match(/h-(\d+|\[.*?\])/);
const heightClass = heightMatch ? heightMatch[0] : "h-2";
return (
<div className={cn("relative w-full", className)}>
<ProgressPrimitive.Root
data-slot="progress"
className={cn(
"bg-primary/20 relative w-full overflow-hidden",
heightClass,
font !== "normal" && "retro"
)}
value={value}
{...props}
>
<ProgressPrimitive.Indicator
data-slot="progress-indicator"
className={cn(
"h-full transition-all",
variant === "retro" ? "flex w-full" : "w-full flex-1",
variant !== "retro" && (progressBg || "bg-primary")
)}
style={
variant === "retro"
? undefined
: { transform: `translateX(-${100 - (value || 0)}%)` }
}
>
{variant === "retro" && (
<div className="flex w-full">
{Array.from({ length: 20 }).map((_, i) => {
const filledSquares = Math.round(((value || 0) / 100) * 20);
return (
<div
key={i}
className={cn(
"flex-1 h-full mx-[1px]",
i < filledSquares
? progressBg || "bg-primary"
: "bg-transparent"
)}
/>
);
})}
</div>
)}
</ProgressPrimitive.Indicator>
</ProgressPrimitive.Root>
<div
className="absolute inset-0 border-y-4 -my-1 border-foreground dark:border-ring pointer-events-none"
aria-hidden="true"
/>
<div
className="absolute inset-0 border-x-4 -mx-1 border-foreground dark:border-ring pointer-events-none"
aria-hidden="true"
/>
</div>
);
}
export { Progress };