Skeleton

A pulsing placeholder in the shape of content that is still loading.

Source
$npx @dinachi/cli@latest add skeleton
avatar
lines

Usage

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

export function ProfileLoading() {
  return <Skeleton className="h-12 w-12 rounded-full" />
}

Examples

An avatar and two lines of text.
import { Skeleton } from '@/components/ui/skeleton';

export function Example() {
  return (
    <div className="flex items-center space-x-4">
      <Skeleton className="h-12 w-12 rounded-full" />
      <div className="space-y-2">
        <Skeleton className="h-4 w-[250px]" />
        <Skeleton className="h-4 w-[200px]" />
      </div>
    </div>
  );
}

Notes

Match the content

Size each skeleton to the element it replaces so the layout does not jump. Compose several for a card or row.

Avoiding a flash

A fast load flashes the skeleton for one frame. Load Transition delays it and holds it for a minimum time once shown.

API

classNamestring
Sets the size and shape, for example h-4 w-48 or rounded-full.

Accessibility

  • A plain div with no role; nothing is announced.
  • Mark loading with aria-busy on the region the skeletons fill.
  • animate-pulse keeps running under reduced motion. Add motion-reduce:animate-none to stop it.