ToroUI

Skeleton

A placeholder loading animation that mimics the shape of content before it loads.


A simple pulsing placeholder used to indicate that content is loading. It renders a div with a muted background and a pulse animation, and can be sized and shaped with utility classes to match the content it represents.

import { Skeleton } from "@/components/ui/skeleton"

export default function SkeletonDemo() {
  return (
    <div className="flex items-center gap-4">
      <Skeleton className="size-12 rounded-full" />
      <div className="space-y-2">
        <Skeleton className="h-4 w-48" />
        <Skeleton className="h-4 w-32" />
      </div>
    </div>
  )
}

Anatomy

import { Skeleton } from "@/components/ui/skeleton"
<Skeleton className="h-4 w-[200px]" />

Examples

Text placeholder

<div className="space-y-2">
  <Skeleton className="h-4 w-[250px]" />
  <Skeleton className="h-4 w-[200px]" />
  <Skeleton className="h-4 w-[150px]" />
</div>

Card skeleton

Combine multiple skeletons to represent a card layout.

<div className="flex items-center gap-4">
  <Skeleton className="size-12 rounded-full" />
  <div className="space-y-2">
    <Skeleton className="h-4 w-[200px]" />
    <Skeleton className="h-4 w-[160px]" />
  </div>
</div>

Image placeholder

Use rounded-md and specific dimensions to represent an image area.

<div className="space-y-3">
  <Skeleton className="h-[200px] w-full rounded-md" />
  <Skeleton className="h-4 w-3/4" />
  <Skeleton className="h-4 w-1/2" />
</div>

API Reference

Skeleton

Renders a <div> with a pulse animation and muted background.

PropTypeDefault
classNamestring
childrenReactNode

Accepts all standard div HTML attributes.