Skip to Content
Zuri
Components

Skeleton

A pulsing placeholder block for loading content.

Live preview
Theme
Preview width

Use Skeleton to hold the shape of content that is loading, so the page does not jump when it arrives. Shape each block with className to match the real content.

Installation

pnpm dlx shadcn@latest add https://components.abdulqadirmsingi.com/r/skeleton.json

Usage

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

<section aria-busy="true" aria-label="Loading transaction">
  <Skeleton className="h-4 w-3/4" />
</section>

Props

Skeleton extends all native <div> props and spreads them onto the element, including ref (React 19). It has no props of its own: size and shape come from className.

Accessibility

  • Skeleton blocks are hidden from assistive technology, because they carry no information.
  • Announce the loading state on the container (aria-busy, with a label) or with a Spinner label, and update it when content arrives.
  • Under prefers-reduced-motion the pulse is turned off.

Tokens used

--muted.

Known limitations

  • It is only a block. There are no pre-built text, avatar or card skeletons yet.

Source

import type { ComponentProps } from "react";import { cn } from "@/lib/utils";/** * A placeholder block shown while content loads. It is hidden from assistive technology: * announce loading on the container instead (e.g. `aria-busy`) or with a Spinner label. */export function Skeleton({ className, ...props }: ComponentProps<"div">) {  return (    <div      aria-hidden="true"      className={cn("animate-pulse rounded-md bg-muted motion-reduce:animate-none", className)}      {...props}    />  );}

On this page