Skip to content

Skeleton

Download .md

A skeleton draws gray placeholders in the shape of the content that is loading, so the page doesn’t jump when it arrives.

  • Use it when you know the shape of what is loading: rows of a list, a card, a profile.
  • Use a Spinner for a short wait without a known shape, such as a button that saves.
  • Match the real layout: the same number of rows and the same sizes, roughly.
React
Memuat rilis…
Vue
Memuat rilis…
12
  1. 1Shape placeholder
  2. 2Line placeholder

Boxes on muted with radius-md and a gentle animate-pulse. The container that is loading carries aria-busy="true" and a screen-reader text such as “Memuat rilis…”.

There is one style. Shape it with size classes: size-10 for an avatar, h-4 w-3/4 for a line of text.

React Vue Flutter Type Default Use
className class width, height on a muted box class none The size and shape.
import { Skeleton } from "@/components/ui/skeleton"
export default function SkeletonDemo() {
return (
<div aria-busy="true" className="grid w-full max-w-sm gap-4">
<span className="sr-only">Memuat rilis…</span>
{[0, 1, 2].map((row) => (
<div key={row} className="flex items-center gap-3">
<Skeleton className="size-10" />
<div className="grid flex-1 gap-2">
<Skeleton className="h-4 w-3/4" />
<Skeleton className="h-3 w-1/2" />
</div>
</div>
))}
</div>
)
}
Terminal window
npx shadcn@latest add https://design.sosialoka.tech/r/react/skeleton.json
  • Put aria-busy="true" on the container that is loading and remove it when the content is in.
  • Give screen readers one text for the whole placeholder, such as “Memuat rilis…”, and hide the boxes from them.
  • The pulse stops with prefers-reduced-motion.