skeleton-loaders

Solid

For building skeleton loading states that are pixel-perfect matches of real content. Use this skill whenever adding loading states to components, building skeletons for async data, handling pending loader states in route transitions, or implementing the shimmer animation pattern. Also trigger when the user asks about preventing layout shift during data fetching.

Web & Frontend 20 stars 3 forks Updated today MIT

Install

View on GitHub

Quality Score: 77/100

Stars 20%
44
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Skeleton Loaders Build skeleton loading states that are pixel-perfect matches of real content. ## Transparent Text Technique Use real HTML elements (`<p>`, `<span>`, `<h2>`, `<button>`) with the same font classes as the real component, plus shimmer + transparency classes. This makes skeletons inherit exact line-height, font-size, and weight, producing pixel-perfect dimensions without hardcoded `h-*`/`w-*` values. ### Shimmer class constant Define a shared class string at the top of the skeleton component: ```tsx const shimmer = 'animate-shimmer rounded-sm bg-linear-to-r from-slate-950 via-slate-900 to-slate-950 bg-size-[200%_100%] text-transparent select-none'; ``` ### Text elements Copy the real component's element type and font classes, add `shimmer`. How you fill the text depends on whether the real text is static or dynamic: - **Static, translatable text** (labels, headings, button text): use the same `t()` value the real component uses. The text is transparent, but reusing `t()` makes the skeleton width match the revealed text exactly. - **Dynamic runtime values** (`{data.name}`, API content): you cannot know the real value, so use hardcoded placeholder text of similar character count to approximate its width. ```tsx import {twJoin} from 'tailwind-merge'; // Real component <h2 className="text-lg font-bold text-white">{t('profile.heading')}</h2> // static <p className="truncate text-sm font-semibold text-white">{data.name}</p> // dynamic <p className="t...

Details

Author
gaia-react
Repository
gaia-react/gaia
Created
1 years ago
Last Updated
today
Language
Shell
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category