npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-auto-skeleton-z

v1.1.1

Published

Automatic skeleton UI generation for React components

Downloads

291

Readme

🦴 react-auto-skeleton-z

NPM Downloads


Automatic skeleton UI generation for React components.
Plugin-first, component-driven, layout-aware skeletons — no wrapper required.

Live Example


✨ Features

  • Auto-generate skeletons from real components
  • Component-driven (Component.skeleton) or plugin-driven
  • Layout-aware → zero layout shift
  • Async / lazy component support
  • Works with any UI library (Antd / MUI / custom)
  • Hook API: useAutoSkeleton

📦 Installation

npm install react-auto-skeleton-z
# or
yarn add react-auto-skeleton-z
  • Import global CSS for animation:
import "react-auto-skeleton-z/styles.css"

🚀 Examples

1️⃣ Basic usage (component .skeleton property)

import React from "react"
import ReactDOM from "react-dom"
import { AutoSkeleton, SkeletonCircle, SkeletonText, SkeletonRect } from "react-auto-skeleton-z"
import "react-auto-skeleton-z/styles.css"

// Real component
function UserCard({ user }) {
  return (
    <div style={{ width: 300, padding: 16, border: "1px solid #ccc", borderRadius: 8 }}>
      <img src={user.avatar} style={{ width: 64, height: 64, borderRadius: "50%" }} />
      <h3>{user.name}</h3>
      <p>{user.email}</p>
      <button>Follow</button>
    </div>
  )
}

// Define skeleton directly on component
UserCard.skeleton = () => (
  <div style={{ width: 300, padding: 16, border: "1px solid #ccc", borderRadius: 8 }}>
    <SkeletonCircle style={{ width: 64, height: 64 }} />
    <SkeletonText />
    <SkeletonText />
    <SkeletonRect style={{ width: "100%", height: 32, marginTop: 8 }} />
  </div>
)

const fakeUser = { avatar: "https://i.pravatar.cc/64", name: "John Doe", email: "[email protected]" }

function App({ loading }) {
  return (
    <AutoSkeleton loading={loading}>
      <UserCard user={fakeUser} />
    </AutoSkeleton>
  )
}

ReactDOM.render(<App loading={true} />, document.getElementById("root"))

✅ Skeleton appears automatically when loading=true
✅ Real UI renders when loading=false

// Profile.tsx => Next example
import React from "react"
import { SkeletonCircle, SkeletonText } from "react-auto-skeleton-z"

export default function Profile({ user }) {
  return (
    <div>
      <img src={user.avatar} />
      <h3>{user.name}</h3>
    </div>
  )
}

// Add skeleton for AutoSkeleton
Profile.skeleton = () => (
  <div>
    <SkeletonCircle />
    <SkeletonText />
  </div>
)


// lazy profile
const LazyProfile = lazy(() => import("./Profile"))

2️⃣ Plugin system

import { createSkeletonPlugin, AutoSkeleton } from "react-auto-skeleton-z"

const ProfilePlugin = createSkeletonPlugin({
  name: "profile",
  rules: [
    {
      match: (el) => el.type?.name === "Profile", 
      skeleton: "circle"
    }
  ],
})

<AutoSkeleton loading plugins={[ProfilePlugin]}>
  <Suspense fallback={<div>Loading...</div>}>
    <LazyProfile />
  </Suspense>
</AutoSkeleton>
  • Plugin allows automatic detection without defining .skeleton for every component.

3️⃣ useAutoSkeleton hook

import React, { lazy, Suspense } from "react"
import { useAutoSkeleton } from "react-auto-skeleton-z"

const LazyProfile = lazy(() => import("./Profile"))

function Page({ loading }) {
  const content = useAutoSkeleton(
    <Suspense fallback={<div>Loading...</div>}>
      <LazyProfile />
    </Suspense>,
    { loading }
  )

  return <>{content}</>
}

export default Page
  • Returns a tree with skeletons automatically injected.

4️⃣ Async / Lazy components

import React, { lazy, Suspense } from "react"
import { AutoSkeleton } from "react-auto-skeleton-z"

const LazyProfile = lazy(() => import("./Profile"))

<AutoSkeleton loading>
  <Suspense fallback={<div>Loading...</div>}>
    <LazyProfile />
  </Suspense>
</AutoSkeleton>
  • Lazy components automatically show skeleton until loaded.

5️⃣ Custom rules (layout-aware)

<AutoSkeleton
  loading
  rules={[
    {
      match: (el) => el.props?.style?.borderRadius === "50%",
      skeleton: "circle",
    },
    {
      match: (el) => el.type === "button",
      skeleton: "rect",
    },
  ]}
>
  <UserCard />
</AutoSkeleton>
  • Rules let you match elements dynamically based on props, type, or other heuristics.

🧠 Why use react-auto-skeleton-z?

  • Zero manual wiring
  • Layout-aware → no layout shift
  • Component-driven → easy maintenance
  • Plugin-friendly → reusable rules
  • Perfect for dashboards, lists, cards, or heavy-loading UIs

📄 License

MIT