Skeletons
Card
Media, headline, body and byline in the same proportions as the real card — so the swap costs zero layout shift.
- card
- grid
- cls
Preview
Usage
<SkeletonCard media footer lines={3} />65 lines
import { Skeleton, type SkeletonAnimation } from "./Skeleton";
import { SkeletonText } from "./SkeletonText";
import { cn } from "@/lib/cn";
export interface SkeletonCardProps {
animation?: SkeletonAnimation;
/** Show the 16:9 media block above the copy. */
media?: boolean;
/** Show the avatar + name row under the copy. */
footer?: boolean;
lines?: number;
stagger?: number;
className?: string;
}
export function SkeletonCard({
animation = "shimmer",
media = true,
footer = true,
lines = 3,
stagger = 90,
className,
}: SkeletonCardProps) {
return (
<div
className={cn(
"w-full overflow-hidden rounded-xl border border-line bg-elevated p-4",
className,
)}
>
{media && (
<Skeleton
animation={animation}
shape="rect"
className="mb-4 aspect-[16/9] w-full"
/>
)}
<div className="space-y-3">
<Skeleton animation={animation} height={14} width="55%" delay={stagger} />
<SkeletonText
lines={lines}
animation={animation}
stagger={stagger}
className="pt-1"
/>
</div>
{footer && (
<div className="mt-5 flex items-center gap-3">
<Skeleton
animation={animation}
shape="circle"
width={32}
delay={stagger * 2}
/>
<div className="flex-1 space-y-2">
<Skeleton animation={animation} height={9} width="35%" delay={stagger * 2} />
<Skeleton animation={animation} height={9} width="22%" delay={stagger * 3} />
</div>
</div>
)}
</div>
);
}
export default SkeletonCard;