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

loading-skeleton-by-subhajit

v1.0.1

Published

npm package to create a beautiful skeleton loader component built with Tailwind and React

Readme

🦴 React Loading Skeletons by Subhajit (npm package)

A lightweight, customizable, and beautiful loading skeleton component library for React, built with Tailwind CSS. Perfect for improving UX during data fetching and loading states.


📦 Installation

npm install loading-skeleton-by-subhajit

or with yarn:

yarn add loading-skeleton-by-subhajit

🚀 Quick Start

import React, { useEffect } from "react"
import { useSkeleton } from "loading-skeleton-by-subhajit"

export default function SkeletonShowcase() {
  const {
    loading,
    simulateLoading,
    Skeleton,
    TextSkeleton,
    AvatarSkeleton,
    CardSkeleton,
    TableSkeleton,
  } = useSkeleton()

  useEffect(() => {
    simulateLoading(2500) // Simulate loading for 2.5 seconds
  }, [])

  return (
    <div className="p-6 space-y-12 max-w-5xl mx-auto">
      {loading ? <TextSkeleton lines={3} /> : <p>Your real content here.</p>}
    </div>
  )
}

🧩 Available Skeleton Components

Skeleton

A basic rectangular skeleton with customizable size and shape.

<Skeleton width="100%" height="2rem" rounded="skeleton-rounded-md" />

| Prop | Type | Default | Description | |-------------|----------|-------------|---------------------------------| | width | string | "100%" | Width of the skeleton | | height | string | "1rem" | Height of the skeleton | | rounded | string | "rounded" | Tailwind class for border radius |


TextSkeleton

Multi-line text placeholder, perfect for loading paragraphs or headlines.

<TextSkeleton lines={4} lastLineWidth="60%" />

| Prop | Type | Default | Description | |-----------------|----------|---------|-----------------------------------------------| | lines | number | 3 | Number of lines | | lastLineWidth | string | 70% | Width of the last line for a more natural look |


AvatarSkeleton

Circle skeleton for avatars or profile pictures.

<AvatarSkeleton size="4rem" />

| Prop | Type | Default | Description | |--------|----------|---------|------------------------------| | size | string | 3rem | Diameter of the avatar circle |


CardSkeleton

A beautiful card-style placeholder for UI previews.

<CardSkeleton />

| Prop | Type | Default | Description | |------|------|---------|-------------| | – | – | – | Pre-styled component, no props required |


TableSkeleton

Mimics a table layout – great for admin dashboards and data-heavy UIs.

<TableSkeleton rows={4} columns={4} />

| Prop | Type | Default | Description | |-----------|----------|---------|-----------------------------| | rows | number | 3 | Number of table rows | | columns | number | 3 | Number of table columns |


🌀 Simulate Loading

Use the built-in loading simulation to trigger skeletons automatically:

simulateLoading(durationInMilliseconds)

Example:

simulateLoading(2500) // Simulates loading for 2.5 seconds

📸 Full Example Showcase

import React, { useEffect } from "react"
import { useSkeleton } from "loading-skeleton-by-subhajit"

export default function SkeletonShowcase() {
  const {
    loading,
    simulateLoading,
    Skeleton,
    TextSkeleton,
    AvatarSkeleton,
    CardSkeleton,
    TableSkeleton,
  } = useSkeleton()

  useEffect(() => {
    simulateLoading(2500)
  }, [])

  return (
    <div className="p-6 space-y-12 max-w-5xl mx-auto">
      {/* Profile Skeleton */}
      <section>
        <h2 className="text-xl font-bold mb-4">Profile Section</h2>
        {loading ? (
          <div className="flex items-center gap-4">
            <AvatarSkeleton size="4rem" />
            <TextSkeleton lines={2} lastLineWidth="50%" />
          </div>
        ) : (
          <div className="flex items-center gap-4">
            <img
              src="/avatar.jpg"
              alt="Avatar"
              className="w-16 h-16 rounded-full object-cover"
            />
            <div>
              <h3 className="text-lg font-medium">Subhajit Bhukta</h3>
              <p className="text-sm text-gray-600">Frontend Developer</p>
            </div>
          </div>
        )}
      </section>

      {/* Custom Skeleton */}
      <section>
        <h2 className="text-xl font-bold mb-4">Custom Skeleton</h2>
        {loading ? (
          <Skeleton width="100%" height="2rem" rounded="skeleton-rounded-md" />
        ) : (
          <div className="text-lg font-medium">Custom content is now loaded!</div>
        )}
      </section>

      {/* Text Skeleton */}
      <section>
        <h2 className="text-xl font-bold mb-4">Text Content</h2>
        {loading ? (
          <TextSkeleton lines={4} lastLineWidth="60%" />
        ) : (
          <p>
            This is the actual paragraph text. It replaces the skeleton after loading is complete.
          </p>
        )}
      </section>

      {/* Card Skeleton */}
      <section>
        <h2 className="text-xl font-bold mb-4">Card Section</h2>
        {loading ? (
          <CardSkeleton />
        ) : (
          <div className="border p-4 rounded-lg shadow space-y-2">
            <img
              src="/thumbnail.jpg"
              alt="Thumbnail"
              className="w-full h-48 object-cover rounded-lg"
            />
            <h4 className="text-lg font-semibold">Sample Card Title</h4>
            <p className="text-sm text-gray-500">This is some description inside a card.</p>
          </div>
        )}
      </section>

      {/* Table Skeleton */}
      <section>
        <h2 className="text-xl font-bold mb-4">Table Section</h2>
        {loading ? (
          <TableSkeleton rows={4} columns={4} />
        ) : (
          <table className="min-w-full border border-gray-300">
            <thead className="bg-gray-100">
              <tr>
                <th className="px-4 py-2 border">Name</th>
                <th className="px-4 py-2 border">Email</th>
                <th className="px-4 py-2 border">Role</th>
                <th className="px-4 py-2 border">Status</th>
              </tr>
            </thead>
            <tbody>
              <tr className="text-sm">
                <td className="px-4 py-2 border">John Doe</td>
                <td className="px-4 py-2 border">[email protected]</td>
                <td className="px-4 py-2 border">Admin</td>
                <td className="px-4 py-2 border">Active</td>
              </tr>
              <tr className="text-sm">
                <td className="px-4 py-2 border">Jane Smith</td>
                <td className="px-4 py-2 border">[email protected]</td>
                <td className="px-4 py-2 border">User</td>
                <td className="px-4 py-2 border">Inactive</td>
              </tr>
            </tbody>
          </table>
        )}
      </section>
    </div>
  )
}

🙌 Author

Made with ❤️ by Subhajit Bhukta
Follow me on GitHub


📃 License

MIT – free for personal and commercial use.