Skeleton
XS, under 350B gzippedA placeholder shape that reserves space for content that has not arrived yet.
- Category
- Feedback & status
- Budget
- xs, static display primitive
- Runtime deps
- None
Preview
This is the exact fixture the conformance suite renders in CI. Switch the language to see the component mirror and reformat.
Install
npx shadcn@latest add https://kata-ui-rho.vercel.app/r/skeleton.jsonCopies the source into your project. Pulls in 1 primitive: cn.
Source
import { cn } from "../lib/cn";
export interface SkeletonProps {
className?: string;
/** Fixed width/height so the real content's box is reserved exactly. */
width?: string | number;
height?: string | number;
}
/**
* A placeholder shape for content that has not arrived yet. `aria-hidden`:
* the shape itself carries no information, and the loading state should
* already be announced once by whatever boundary is showing this (see
* `AsyncBoundary`) — a screen reader does not need to hear "loading" once per
* skeleton row.
*/
export function Skeleton({ className, width, height }: SkeletonProps) {
return (
<div
aria-hidden="true"
style={{ width, height }}
className={cn(
"animate-pulse rounded-md bg-neutral-200 motion-reduce:animate-none dark:bg-neutral-800",
className,
)}
/>
);
}
What CI checks
- Bundled, minified and gzipped against its tier budget
- Audited by axe in the state previewed above
- Rendered through react-dom/server with no browser globals
- Scanned for network calls, dangerous sinks, and unguarded animation