GooseUI

Components

Skeleton


Placeholders for content that is still loading. Three animations (pulse, shimmer, wave), ready-made shapes, a group that runs one shimmer across all its blocks, and a fade-in for the real content. Plain CSS in a server component, no JavaScript. With reduced motion the blocks stay still.

Browser Support

@starting-style

SkeletonReveal fades content in through @starting-style. Browsers without it show the content at once, nothing breaks.

Your browser:

Preview

One shimmer crosses the avatar, both lines and the button.

Loading…

Installation

npx shadcn@latest add @gooseui/skeleton
pnpm dlx shadcn@latest add @gooseui/skeleton
yarn dlx shadcn@latest add @gooseui/skeleton
bunx --bun shadcn@latest add @gooseui/skeleton

Usage

import {
  Skeleton,
  SkeletonGroup,
  SkeletonText,
} from "@/components/ui/skeleton"

// Same as shadcn: size it with classes
<Skeleton className="h-4 w-32" />

// One shimmer across all blocks, with a label for screen readers
<SkeletonGroup variant="shimmer" label="Loading profile…" className="flex gap-3">
  <Skeleton shape="circle" className="size-12" />
  <div className="flex-1 space-y-2">
    <Skeleton shape="text" className="w-2/5" />
    <SkeletonText lines={2} />
  </div>
</SkeletonGroup>

Examples

Profile card: pulse, shimmer, wave

The same card with three animations. Pulse fades every block together, shimmer sends one highlight across the group, wave lights the rows up from top to bottom.

pulse

Loading profile…

shimmer

Loading profile…

wave

Loading profile…
{(["pulse", "shimmer", "wave"] as const).map((variant) => (
  <Card key={variant} className="gap-0 p-5">
    <SkeletonGroup variant={variant} className="space-y-4">
      <div className="flex items-center gap-3">
        <Skeleton shape="circle" className="size-12" />
        <div className="flex-1 space-y-2">
          <Skeleton shape="text" className="w-2/5" />
          <Skeleton shape="text" className="h-3 w-3/5" />
        </div>
      </div>
      <SkeletonText lines={2} lineClassName="h-3" />
    </SkeletonGroup>
  </Card>
))}

Comment feed

All rows sit in one SkeletonGroup, so the shimmer passes through avatars and lines as one wave instead of restarting in every block.

Loading comments…
<SkeletonGroup label="Loading comments…" className="space-y-6">
  {[2, 1, 3, 2].map((lines, index) => (
    <div key={index} className="flex items-start gap-4">
      <Skeleton shape="circle" />
      <div className="flex-1 space-y-3">
        <Skeleton shape="text" className="h-3.5 w-28" />
        <SkeletonText lines={lines} lineClassName="h-3" />
      </div>
    </div>
  ))}
</SkeletonGroup>

Article card with a 16:9 cover

The cover keeps its ratio with aspect-video, the corners match the real card.

Loading article…
<Card className="gap-0 p-4">
  <SkeletonGroup className="space-y-4">
    <Skeleton className="aspect-video w-full rounded-lg" />
    <div className="space-y-3">
      <Skeleton shape="text" className="h-5 w-16 rounded-full" />
      <Skeleton shape="text" className="h-5 w-4/5" />
      <SkeletonText lines={2} lineClassName="h-3" />
    </div>
    <div className="flex items-center gap-3">
      <Skeleton shape="circle" className="size-8" />
      <div className="flex-1 space-y-1.5">
        <Skeleton shape="text" className="h-3 w-24" />
        <Skeleton shape="text" className="h-3 w-16" />
      </div>
      <Skeleton className="h-8 w-20" />
    </div>
  </SkeletonGroup>
</Card>

Table 4 × 5

The header is real, the cells are placeholders. In a wave group the rows light up one after another. Cell widths are fixed classes, so the markup is the same on the server and in the browser.

Loading table…
NameStatusRoleAmount
<SkeletonGroup variant="wave" className="overflow-hidden rounded-lg border">
  <table className="w-full text-sm">
    <thead>…real header…</thead>
    <tbody>
      {rows.map((row, index) => (
        <tr key={index} className="border-t">
          <td className="h-14 px-4">
            <div className="flex items-center gap-3">
              <Skeleton shape="circle" className="size-8" />
              <Skeleton shape="text" className={`h-3.5 ${row.name}`} />
            </div>
          </td>
          <td className="px-4"><Skeleton className={`h-5 rounded-full ${row.status}`} /></td>
          <td className="px-4"><Skeleton className={`h-3.5 ${row.role}`} /></td>
          <td className="px-4"><Skeleton className={`ml-auto h-3.5 ${row.amount}`} /></td>
        </tr>
      ))}
    </tbody>
  </table>
</SkeletonGroup>

Live: skeleton and content of the same shape

The switch swaps the placeholder for content. The rows keep their heights, so the card does not jump. The numbers use Skeleton with loading: they stay in layout, invisible, and the placeholder is exactly as wide as the value.

Loading profile…

Followers

Following

Posts

const [loading, setLoading] = useState(true)

// Rows have fixed heights in both states, so the card keeps its size
{loading ? (
  <SkeletonGroup label="Loading profile…">…placeholders…</SkeletonGroup>
) : (
  <SkeletonReveal>…real content…</SkeletonReveal>
)}

// The value stays in layout: the placeholder is as wide as the text
<Skeleton loading={loading} className="w-fit rounded-sm text-lg font-semibold">
  12.4k
</Skeleton>

Props

PropTypeDefaultDescription
variant"pulse" | "shimmer" | "wave""pulse"Animation. Without a value it follows the surrounding SkeletonGroup, and without a group it is pulse.
shape"rect" | "text" | "circle""rect"Ready-made shape: text is a full-width line, circle is a 40px round block, rect has no size, like shadcn.
loadingbooleantrueWorks with children. true shows the placeholder and keeps the children invisible but laid out, so the size matches the content. false fades the children in.
classNamestring-Size, radius and color. Overrides the shape, so h-4 w-32 works as in shadcn.

Components

SkeletonGroup

Wraps blocks so shimmer and wave run as one sweep across all of them. Adds role=status, aria-busy and a hidden label. The band has one angle and one speed for all blocks, like a mask with holes. The group uses transform, so position: fixed inside it is relative to the group.

PropTypeDefaultDescription
variant"pulse" | "shimmer" | "wave""shimmer"Animation of every block inside. A block can override it.
labelstring"Loading…"Text for screen readers.
classNamestring-Additional CSS classes.

SkeletonText

A paragraph of lines. Widths are fixed (the last line is 62%), not random, so the server and the browser render the same markup.

PropTypeDefaultDescription
linesnumber3Number of lines.
variant"pulse" | "shimmer" | "wave"-Animation of every line.
lineClassNamestring-Classes for every line, for example a height.
classNamestring-Additional CSS classes.

SkeletonReveal

Wrapper for the real content that replaces a placeholder, for example in a Suspense boundary. The content fades in on mount.

PropTypeDefaultDescription
classNamestring-Additional CSS classes.