Skeleton

An animated placeholder for loading states.

Installation

$
npx shadcn@latest add https://ui.mattdowney.com/r/skeleton.json

Usage

import { Skeleton, SkeletonText, SkeletonReveal } from "@/components/ui/skeleton"

Examples

Default

Placeholder blocks in the shape of what is loading. Size each one with className, and match the real layout: that is what stops the page jumping when the content lands.

Text

Lines of text still loading. Set the type the real text will have: each line takes that line height, so the swap does not jump and a control beside the first line stays put.

Reveal

When loading ends, the content fades in as the placeholder fades out, so there is no blank beat. Shape the placeholder like the content and the box does not move. Press Load again to replay it.

API Reference

PropTypeDefaultDescription
stillSkeletonbooleanfalseTurns the pulse off. The pulse means loading; use still when the blocks are the picture itself, such as a wireframe thumbnail of a page.
linesSkeletonTextnumber3How many lines. The last of several stops at two thirds, like a paragraph.
loadedSkeletonRevealbooleanNoneFalse shows placeholder. True fades the content in and the placeholder out together over 200ms; at once under reduced motion.
placeholderSkeletonRevealReactNodeNoneWhat shows while loading, in the content's shape: Skeleton blocks or SkeletonText.
stillSkeletonboolean = falseTurns the pulse off. The pulse means loading; use still when the blocks are the picture itself, such as a wireframe thumbnail of a page.
linesSkeletonTextnumber = 3How many lines. The last of several stops at two thirds, like a paragraph.
loadedSkeletonRevealbooleanFalse shows placeholder. True fades the content in and the placeholder out together over 200ms; at once under reduced motion.
placeholderSkeletonRevealReactNodeWhat shows while loading, in the content's shape: Skeleton blocks or SkeletonText.