logo

Nurav UI

Community
Components

Skeleton

Use skeletons to provide a low-fidelity representation of your content while it's loading.Copy Markdown

Preview

The Skeleton component provides a fluid placeholder for your UI elements. Below is an overview of all variants and common layouts.

Loading...

Profile Layout

Perfect for user profiles, comments, or team member sections.

Loading...

Feed Post

Ideal for social media feeds, blog lists, or card-heavy dashboards.

Loading...

Grid Cards

Use this for product listings, portfolios, or data-driven grids.

Loading...

Installation

Automatic (CLI)

Terminal
npx shadcn@latest add https://nurav-ui.vercel.app/r/skeleton.json

Manual Setup

Install Dependencies

Terminal
npm install motion clsx tailwind-merge

Create Component

Copy the following code into your project (e.g., components/nurav-ui/Skeleton.tsx).

Skeleton.tsx
"use client";

import React from "react";
import { motion, HTMLMotionProps } from "motion/react";
import { cn } from "@/lib/utils";

interface SkeletonProps extends HTMLMotionProps<"div"> {
  animation?: "pulse" | "shimmer" | "none";
  shimmerColor?: string;
}

export const Skeleton = ({
  className,
  animation = "pulse",
  shimmerColor = "rgba(255, 255, 255, 0.05)",
  ...props
}: SkeletonProps) => {
  if (animation === "pulse") {
    return (
      <motion.div
        initial={{ opacity: 0.5 }}
        animate={{ opacity: [0.5, 0.3, 0.5] }}
        transition={{
          duration: 1.5,
          repeat: Infinity,
          ease: "easeInOut",
        }}
        className={cn("rounded-md bg-foreground/10", className)}
        {...props}
      />
    );
  }

  if (animation === "shimmer") {
    return (
      <motion.div
        className={cn(
          "relative overflow-hidden rounded-md bg-foreground/10",
          className
        )}
        {...props}
      >
        <motion.div
          initial={{ x: "-100%" }}
          animate={{ x: "100%" }}
          transition={{
            duration: 1.5,
            repeat: Infinity,
            ease: "linear",
          }}
          className="absolute inset-0 z-0"
          style={{
            background: `linear-gradient(90deg, transparent 0%, ${shimmerColor} 50%, transparent 100%)`,
          }}
        />
      </motion.div>
    );
  }

  return (
    <motion.div
      className={cn("rounded-md bg-foreground/10", className)}
      {...props}
    />
  );
};

Examples

Pulse Animation

The default animation that creates a soft, breathing effect.

<Skeleton className="w-[100px] h-4" animation="pulse" />

Shimmer Animation

A linear animated gradient that sweeps across the element, common in high-end apps.

<Skeleton className="w-full h-32" animation="shimmer" />

Custom Shapes

Since it uses Tailwind classes, you can easily create circles, squares, or complex rounded shapes.

<Skeleton className="h-20 w-20 rounded-full" />
<Skeleton className="h-4 w-1/4 rounded-none" />

API Reference

PropTypeDefaultDescription
animation
'pulse' | 'shimmer' | 'none''pulse'The animation style to use.
shimmerColor
string'rgba(255, 255, 255, 0.05)'Custom color for the shimmer gradient.
className
stringundefinedCustom styling for dimensions and rounding.

Built by Varun

Last Updated:April 10, 2026

On this page