Shimmer Skeleton

Content placeholder with a shimmer sweep.

Tailwind CSS
<div class="w-64 space-y-3" role="status" aria-label="Loading">
  <div class="h-4 rounded bg-slate-300 overflow-hidden relative">
    <div class="absolute inset-y-0 w-full animate-[shimmer2_1.5s_infinite] bg-gradient-to-r from-transparent via-white/70 to-transparent"></div>
  </div>
  <div class="h-4 rounded bg-slate-300 w-5/6"></div>
  <div class="h-4 rounded bg-slate-300 w-4/6"></div>
</div>
<style>
@keyframes shimmer2 {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
</style>

Free to use in personal and commercial projects. No attribution required.

Variants

Same component, different looks. Preview each one live and copy the code you like.

Profile card

Profile shaped skeleton for comment threads and user lists.

Tailwind CSS

Image block

Image placeholder skeleton for cards and article previews.

Tailwind CSS

Dark

Dark mode skeleton with a subtler shine for night interfaces.

Tailwind CSS

About this shimmer skeleton

Skeleton screens beat spinners for perceived performance. Instead of a generic loader, you show the shape of incoming content with a shimmer sweep suggesting activity. Users perceive skeletons as faster because the layout does not jump when content arrives.

This skeleton loader uses three bars at varied widths (full, 5/6, 4/6) mimicking text lines. The shimmer is a white gradient sweeping across via the shimmer2 keyframe, animating transform from -100% to 100% on a 1.5s loop.

Match skeleton shapes to your content: image blocks, text lines, avatar circles. The closer the skeleton matches the final layout, the less jarring the swap. Skeletons are for content loading, not actions; never put one on a button.

The worst loading experience is not slow, it is jumpy: a spinner floating in an empty box, then content slamming in and shoving everything down the page. Users perceive that jolt as slower than the actual wait. Skeletons fix the perception by reserving the shape of what is coming; the layout is already correct, so when real content arrives it simply replaces gray bars and the swap feels instant. The shimmer on top adds the still working reassurance.

Each bar is bg-slate-300 with rounded corners, holding an absolute inset-y-0 child painted with bg-gradient-to-r from-transparent via-white/70 to-transparent. The custom shimmer2 keyframe sweeps that gradient from translateX(-100%) to translateX(100%) on a 1.5s infinite loop, and the parent's overflow-hidden clips the sweep to the bar. Varied widths (full, 5/6, 4/6) mimic lines of text so the skeleton previews the real layout.

Mirror your actual content: rounded-full w-10 h-10 for avatars, aspect-video blocks for images, h-4 bars for text lines. On light themes, dim the sweep to via-white/40 so it glimmers instead of flashing. Slow the loop to 2s for expected waits like initial page loads; a calmer shimmer suits a longer wait, while 1.5s suits quick refreshes.

The mistake is turning the skeleton into theater: showing it for a fixed two seconds even when the data arrived in 200ms. Users on fast connections watch gray bars pulse for no reason, and a fast app feels deliberately slow. Skeletons are placeholders, not splash screens. Render real content the instant it arrives; the skeleton should never outlive the wait it represents.

Where to use it

  • ✓ Feed loading
  • ✓ Card grids
  • ✓ Article pages
  • ✓ Dashboard widgets

Customization tips

Match bar widths to your content layout. Use rounded-full for avatar skeletons and larger rounded blocks for images. Slow to 2s for a calmer feel.

Design notes

When to use

Use it for content loading in feeds, card grids, article pages, and dashboard widgets. Showing the shape of incoming content beats a generic spinner because the layout does not jump when real content arrives, which users perceive as faster. Match the skeleton bars to your actual layout.

What to avoid

Do not use skeletons for actions like button presses; they are for content loading, not for confirming an action. Do not use generic bars when your content has a distinct shape; a skeleton that looks nothing like the final layout still causes a jarring swap.

Accessibility

Mark the loading region with aria-busy=true and give the skeleton role=status with a label. Disable the shimmer sweep under prefers-reduced-motion.

Frequently asked questions

Skeleton vs spinner, which is better?

Skeletons feel faster because they preserve layout and hint at content shape. Spinners are simpler and suit small inline loads. Use skeletons for content areas.

How does the shimmer effect work?

A white gradient strip animates translateX across the skeleton bars on a loop. The movement suggests activity while content loads.

Should skeletons be accessible?

Wrap in role=status with aria-label='Loading'. Hide the skeleton from screen readers once real content arrives.

How do I make the shimmer sweep left to right in CSS?

Put a linear-gradient background on the skeleton block with a background-size of 200 percent width, then animate background-position from -200% to 200% in keyframes. The oversized gradient creates a bright band that travels across the block, which reads as the shimmer sweep.

Why does my skeleton cause layout shift when content loads?

The skeleton blocks are a different size than the real content. Match the skeleton's heights, widths, and spacing to the actual layout: image blocks at the same aspect ratio, text lines at the same line height. When the shapes match, the swap from skeleton to content is invisible.

Should the shimmer animate forever or stop after a while?

Let it loop while loading is genuinely in progress, but cap the total loading time in your code. A skeleton that shimmers forever on a failed request looks broken. After a timeout, replace it with an error state and a retry button instead of an endless shimmer.

Customize it with our tools