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-magic

v1.0.0

Published

Automatic skeleton loader generator for React

Readme

react-auto-skeleton-loader

A zero-config, "magic" skeleton loader generator for React. Wrap your component, and it automatically generates a skeleton layout matching your actual UI structure.

📦 Installation

npm install react-auto-skeleton-loader
# or
yarn add react-auto-skeleton-loader

🚀 Usage

  1. Import the component and styles.
  2. Wrap your target component with <AutoSkeleton>.
  3. Pass loading={true} to see the skeleton.

Important: Your component must render its layout structure (even with dummy data/text) for the skeleton to measure it. The library makes the content invisible and draws skeletons over it.

import { AutoSkeleton } from 'react-auto-skeleton-loader';
import 'react-auto-skeleton-loader/dist/style.css'; 

function UserProfile({ isLoading, user }) {
  // Even when loading, render the layout!
  // Use safe checks (user?.name) or dummy data.
  
  return (
    <AutoSkeleton loading={isLoading}>
      <div className="card">
        <img 
            src={user?.avatar || '/placeholder.png'} 
            className="avatar" 
            alt="avatar" 
        />
        <h3>{user?.name || 'User Name'}</h3>
        <p>{user?.bio || 'Short user bio goes here...'}</p>
        <button>Follow</button>
      </div>
    </AutoSkeleton>
  );
}

⚙️ Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | loading | boolean | Required | When true, hides children and shows skeleton overlay. | | children| ReactNode| Required | The component layout to analyze. | | animate | boolean | true | Enable/disable shimmer animation. |

🛠 How it Works

  1. Wraps your children in a relative container.
  2. Hides the children using visibility: hidden opacity 0 (so they retain layout size).
  3. Analyzes the DOM using BoundingClientRect to find images, headings, buttons, and text blocks.
  4. Overlays absolute positioned skeleton blocks that match the exact geometry of your elements.
  5. Updates automatically if the layout changes (via ResizeObserver and MutationObserver).

⚠️ Limitations

  • Render Required: Your component must be mounted and render DOM elements for them to be measured. If your component returns null when loading, no skeleton will appear.
  • Complex styles: Elements with complex shapes (clip-path) or transforms might not be perfectly matched, though standard transforms usually trigger correct bounding boxes.
  • Leaf Nodes: The analyzer focuses on "leaf" content (text, images, inputs). Container divs usually aren't drawn unless they have specific backgrounds, to avoid clutter.

👨‍💻 Author

Vedant Yengupatla

🤝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check logic in src/hooks/useSkeletonAnalyzer.ts if you want to improve the heuristics.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

Distributed under the MIT License. See LICENSE for more information.