auto-loading-skeleton · v 4.0.0

The Definitive
React Skeleton Library

V4 introduces AI layout prediction, skeleton tree diffing, the Slot system, visual DevTools, React 18 streaming hooks, and 10 new primitives — all with zero runtime dependencies.

Live demo
V1 · 7 files · 7 types · 1 hook V2 · 9 files · 12 types · 4 hooks V4 · 16 files · 25 types · 12 hooks
What's new in V4
🤖
AI Layout Predictionnew
When confidence < 0.5, uses sibling context to predict node type. Avatars next to text → name heading.
🔀
Skeleton Tree Diffingnew
Compares descriptor hash to previous render. Unchanged subtrees skip renderNode entirely — near-zero re-render cost.
🎰
Slot Systemnew
<SkeletonSlot type="avatar:56"> marks explicit regions. Zero ambiguity, confidence=1.0, no analyzer pass needed.
🛠️
Visual DevToolsnew
Floating panel shows descriptor tree, confidence scores, cache hit rate, and active instances during development.
🌊
Streaming Hooknew
useSkeletonStream supports React 18 streaming responses and async iterables — chunks grow as data arrives.
📄
Pagination Hooknew
useSkeletonPagination: tracks paginated loading state — initial vs page-loading separately.
📋
Form Hooknew
useSkeletonForm tracks per-field loading state for complex forms with multiple async data sources.
⚡
Preload Hooknew
useSkeletonPreload pre-warms descriptor cache via requestIdleCallback — first loading state is instant.
🏗️
25 Node Typesnew
SWITCH, SLIDER, CALENDAR, STEPPER, BREADCRUMB, PAGINATION, MAP, CHIP_INPUT, DRAWER, FORM_FIELD added.
🎨
7 New Animations
shimmer, pulse, wave, glow, scan, blink, flow — 7 total. All prefers-reduced-motion + forced-colors aware.
🌗
12 Theme Presets
aurora, midnight, chalk, paper added. All use CSS @layer for clean specificity. Per-instance scoped vars.
🧩
30 Primitives
SkeletonKanban, SkeletonChatBubble, SkeletonSwitch, SkeletonCalendar + 6 more brand-new components.
Interactive demo
loading = true
animation:
theme:
stagger ✦
ProductCard
ProfileCard
StatCards
DataTable

✦ = new in V4 · blink and flow are new animation styles · aurora, chalk, paper are new themes

10 brand-new primitives in V4. These are impossible to build with V1-V3.

Feature V1 V2 V3 V4
Slot System — zero-ambiguity skeletons
import { AutoSkeleton, SkeletonSlot } from 'auto-loading-skeleton-v4';

// Mark explicit regions with SkeletonSlot — confidence = 1.0
function ProductCard({ product }) {
  return (
    <div>
      <SkeletonSlot type="image"   height="200px"   />
      <SkeletonSlot type="heading" width="70%"    />
      <SkeletonSlot type="text"    lines={3}        />
      <SkeletonSlot type="button"  width="120px"  />
      {/* Real content — shown when loading=false */}
      <img src={product.img} />
      <h2>{product.title}</h2>
      <p>{product.desc}</p>
      <button>Add to cart</button>
    </div>
  );
}

<AutoSkeleton loading={loading}>
  <ProductCard product={data} />
</AutoSkeleton>
useSkeletonStream — React 18 streaming
import { useSkeletonStream, AutoSkeleton } from 'auto-loading-skeleton-v4';

function StreamingFeed() {
  const { chunks, loading, isEmpty } = useSkeletonStream(
    async function*() {
      const stream = await fetch('/api/feed/stream');
      const reader = stream.body.getReader();
      while (true) {
        const { done, value } = await reader.read();
        if (done) break;
        yield JSON.parse(decode(value));
      }
    },
    []
  );

  return (
    <div>
      {chunks.map((chunk, i) => (
        <FeedItem key={i} data={chunk} />
      ))}
      {loading && <AutoSkeleton loading={true} count={3}>
        <FeedItem />
      </AutoSkeleton>}
    </div>
  );
}
SkeletonDevTools — visual inspector
import { SkeletonDevTools } from 'auto-loading-skeleton-v4';

// Add once to app root — renders null in production automatically
function App() {
  return (
    <>
      <YourApp />
      <SkeletonDevTools />  // floating panel, dev only
    </>
  );
}

// Panel shows:
// • Descriptor tree with confidence % per node
// • Cache hits / misses / hit rate
// • All active loading instances
// • Animation + theme per instance
v4