Card
Display
Container component with pixel-art styling for displaying content.
Import
import { PixelCard, PixelCardHeader, PixelCardTitle, PixelCardDescription, PixelCardContent, PixelCardFooter } from "@/components/ui/pixel-card"Usage
Card Title
Card description goes here
This is the card content area.
Component Source
Copy and paste the following code into your project at /src/components/ui/pixel-card.tsx
"use client";
import * as React from "react";
import { cn } from "@/lib/utils";
const PixelCard = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn(
"pixel-borders border-4 p-6 bg-[#fffacd] border-black shadow-[6px_6px_0px_0px_rgba(0,0,0,1)] dark:bg-[#1a1a1a] dark:border-[#ff8c00] dark:shadow-[6px_6px_0px_0px_rgba(255,140,0,0.3)]",
className,
)}
{...props}
/>
));
PixelCard.displayName = "PixelCard";
const PixelCardHeader = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("flex flex-col space-y-2 pb-4", className)}
{...props}
/>
));
PixelCardHeader.displayName = "PixelCardHeader";
const PixelCardTitle = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLHeadingElement>
>(({ className, ...props }, ref) => (
<h3
ref={ref}
className={cn(
"text-base font-bold uppercase tracking-wider font-[family-name:var(--font-pixel)] leading-relaxed dark:text-[#ffd700]",
className,
)}
{...props}
/>
));
PixelCardTitle.displayName = "PixelCardTitle";
const PixelCardDescription = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLParagraphElement>
// ... (more code below)Accessibility
This component is built with accessibility in mind, including proper ARIA attributes, keyboard navigation, and focus management.