Unified UI

Skeleton

Loading placeholder components that mimic content shapes with a pulse animation.

Basic

Loading placeholders that mimic the shape of content before it loads. Supports text lines, circles, and rectangles with a gentle pulse animation.

Installation

Install the component via the CLI in one command.

npx @work-rjkashyap/unified-ui add skeleton
pnpm dlx @work-rjkashyap/unified-ui add skeleton
npx @work-rjkashyap/unified-ui add skeleton
bunx @work-rjkashyap/unified-ui add skeleton

If you haven't initialized your project yet, run npx @work-rjkashyap/unified-ui init first. See the CLI docs for details.

Or install the full package

Use this approach if you prefer to install the entire design system as a dependency instead of copying individual components.

npm install @work-rjkashyap/unified-ui
pnpm add @work-rjkashyap/unified-ui
yarn add @work-rjkashyap/unified-ui
bun add @work-rjkashyap/unified-ui

Anatomy

import {
	Skeleton,
	SkeletonText,
	SkeletonCircle,
	SkeletonRect,
} from "@work-rjkashyap/unified-ui";

Basic Skeleton

The base Skeleton component renders a single animated placeholder. Use the shape prop to control its form.

<Skeleton shape="text" />
<Skeleton shape="circle" size="md" />
<Skeleton shape="rect" width={200} height={120} />

SkeletonText

Renders one or more text-line placeholders. Use the lines prop to control the number of lines. The last line is automatically shorter for a natural appearance.

1 line

3 lines

5 lines

Text Sizes

Two sizes control the height of each text line to match your typography scale.

Small

Medium (default)

SkeletonCircle

Renders a circular placeholder. Perfect for avatar and icon loading states.

SizeDimensionsMatches
xs24×24pxAvatar xs
sm32×32pxAvatar sm
md40×40pxAvatar md
lg48×48pxAvatar lg
xl64×64pxAvatar xl

SkeletonRect

Renders a rectangular placeholder with configurable width and height. Useful for images, cards, and media content loading states.

Composition Examples

User Card Skeleton

A common loading pattern for user profile cards.

Article Skeleton

A loading placeholder for article or blog post content.

Table Row Skeleton

Loading state for data table rows.

Custom Dimensions

Both width and height accept numbers (pixels) or strings (CSS values like percentages or auto).

// Pixel values
<SkeletonRect width={300} height={200} />

// CSS string values
<SkeletonRect width="100%" height={120} />
<SkeletonRect width="50%" height="8rem" />

// Full width text
<SkeletonText lines={2} className="w-full" />

Props

Skeleton

PropTypeDefaultDescription
shape"text" | "circle" | "rect""text"Shape of the skeleton placeholder.
size"xs" | "sm" | "md" | "lg" | "xl""md"Size preset (used with circle shape).
widthnumber | stringCustom width. Numbers are treated as pixels.
heightnumber | stringCustom height. Numbers are treated as pixels.
classNamestringAdditional CSS classes.

SkeletonText

PropTypeDefaultDescription
linesnumber3Number of text lines to render.
size"sm" | "md""md"Height of each text line.
classNamestringAdditional CSS classes.

SkeletonCircle

PropTypeDefaultDescription
size"xs" | "sm" | "md" | "lg" | "xl""md"Diameter of the circle.
classNamestringAdditional CSS classes.

SkeletonRect

PropTypeDefaultDescription
widthnumber | string"100%"Width of the rectangle.
heightnumber | string80Height of the rectangle.
classNamestringAdditional CSS classes.

Accessibility

Skeleton placeholders are purely decorative and should not convey meaningful information.

  • All skeleton elements render with aria-hidden="true" so screen readers skip them.
  • The root element uses role="presentation" to indicate decorative content.
  • The pulse animation automatically respects prefers-reduced-motion — when the user prefers reduced motion, the animation is disabled via the global CSS rule in styles.css.
  • When using skeletons as loading states, ensure the surrounding container or page communicates the loading state to assistive technology (e.g., via aria-busy="true" on the parent, or a visually hidden "Loading..." text).

Reduced Motion

The skeleton pulse animation is defined via animate-pulse in Tailwind, which is automatically disabled when the user has prefers-reduced-motion: reduce enabled. No additional configuration is needed.

/* Handled globally in styles.css */
@media (prefers-reduced-motion: reduce) {
	.animate-pulse {
		animation: none;
	}
}

Design Tokens

TokenUsage
--mutedSkeleton placeholder background
--radius-smText line and rect border radius
--radius-fullCircle shape border radius

On this page