Skip to content
IndexRequest a UIAboutContact

Skeleton Loading

Grey content-shaped placeholders with a soft shimmer while data loads.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI CODING TOOL
Build a card list with a skeleton state. Each card has a 16:9 image area, a title line, two text lines and an avatar with a name line. In the loading state render grey blocks with the same dimensions using a CSS class .sk and a shimmer: a linear-gradient (surface-2, lighter tone, surface-2) at 200% width animated with background-position over 1400ms linear infinite. Set aria-busy="true" on the list while loading. A "Load content" button simulates a 1.6 second request, then fades the real cards in over 200ms and sets aria-busy="false"; a "Reset" button returns to the skeleton. Matching sizes prevents layout shift. Disable the shimmer for prefers-reduced-motion and keep the blocks static.

About this pattern

Definition

A placeholder that mimics the layout of content that is still loading: blocks for the image, lines for the text. A soft light sweeps across the blocks to show that the page is alive.

Purpose & UX principles

  • Shows the page's structure immediately, so the wait feels shorter and the layout does not jump when content arrives.
  • Use for content-heavy areas that take more than about a second; for shorter waits a spinner or nothing is better.
  • The skeleton must match the final layout dimensions, otherwise the swap causes a visible shift.

Interaction states

  • Loading: skeleton visible, container has aria-busy="true".
  • Loaded: real content fades in over the skeleton, aria-busy="false".
  • Failed: replace with an inline error and a retry button; never leave a skeleton forever.

Motion specification

  • Shimmer: gradient moving across the block, 1400ms linear infinite.
  • Content swap: 200ms fade.
  • Reduced motion: no shimmer; a static, slightly pulsing opacity is also avoided.

Responsive behaviour

  • Build the skeleton from the same grid as the real content so it adapts to the same breakpoints.
  • Reserve aspect ratio for images with aspect-ratio.

Code

HTML
<div class="ctl"><button id="load">Load content</button><button id="reset">Reset</button></div>
<div class="cards" id="cards" aria-busy="true"></div>

Related patterns

Spinner

↗
SpinnerLoading & Progress

Progress Indicator

↗
Progress IndicatorLoading & Progress

Toast

↗
ToastFeedback & Notifications