GitHub

Skeleton

Animated loading placeholder that preserves layout while content is fetching and gives users a clearer sense of what is about to appear.

AccessibleDark Mode3 VariantsAnimated

Install

$npx react-principles add skeleton
01

Theme Preview

Light
Dark

Line

Rect

Circle

03

Code Snippet

src/ui/Skeleton.tsx
import { Skeleton } from "@/ui/Skeleton";

<div className="space-y-3">
  <Skeleton variant="line" width="70%" />
  <Skeleton variant="line" width="45%" />
  <Skeleton variant="rect" className="h-24" />
</div>
04

Copy-Paste (Single File)

Skeleton.tsx
import { cn } from "@/lib/utils";

export type SkeletonVariant = "line" | "rect" | "circle";

export interface SkeletonProps {
  variant?: SkeletonVariant;
  width?: number | string;
  height?: number | string;
  className?: string;
}
05

Props

PropTypeDefaultDescription
variant"line" | "rect" | "circle""line"Switches between text-line, block, and circular placeholder shapes.
widthnumber | stringOptional inline width override for the placeholder.
heightnumber | stringOptional inline height override for the placeholder.
classNamestringAdditional classes merged into the skeleton element.
react-principles