Skip to content
← Components

Skeleton

Skeleton with thoughtful defaults, semantic styling, and editable source.

Open ↗

Make it yours.

Install the editable source and its dependencies into your React + Tailwind project.

Scroll horizontally for long lines
pnpm dlx shadcn@4.0.8 add http://localhost:3000/r/skeleton.json

Use it

Scroll horizontally for long lines
"use client";
import { Skeleton } from "@/components/jez-ui/ui/skeleton";

export default function Example() {
  return (
    <>
      <div className="grid w-full max-w-sm gap-5">
        <Skeleton className="h-40 rounded-xl" />
        <div className="flex items-center gap-4">
          <Skeleton className="size-11 rounded-full" />
          <div className="grid flex-1 gap-3">
            <Skeleton className="w-3/4" />
            <Skeleton className="w-1/2" />
          </div>
        </div>
        <p className="text-xs text-muted-foreground">
          Making room for the next good thing.
        </p>
      </div>
    </>
  );
}

Props & types

Scroll horizontally for long lines
React.ComponentProps<"div">

Source

View 2 source files

registry/ui/skeleton.tsx

Scroll horizontally for long lines
"use client";
import * as React from "react";
import { cn } from "./utils";
export function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      aria-hidden="true"
      className={cn(
        "h-5 w-full rounded bg-muted motion-safe:animate-pulse",
        className,
      )}
      {...props}
    />
  );
}

registry/ui/utils.ts

Scroll horizontally for long lines
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...values: ClassValue[]) {
  return twMerge(clsx(values));
}

Dependencies

clsx@2.1.1 · tailwind-merge@3.5.0

Accessibility & behaviour

Provide meaningful labels and preserve keyboard focus styles. Check contrast when customising theme colours.

Read the accessibility and performance guide →