Components
Loading Shimmer
A shimmer for loading placeholders.
<LoadingShimmer>
<CardSkeleton />
</LoadingShimmer>Installation
npx shadcn@latest add https://ui.zjkm.tech/r/loading-shimmer.jsonimport { LoadingShimmer } from "@/components/loading-shimmer"Using JavaScript? Set tsx: false in components.json and the CLI converts it.
New to shadcn? Run npx shadcn@latest init first. The CLI needs components.json and the @/ import alias.
Usage
Wrap your placeholder shapes. A band of light sweeps across them, and the wrapper sets aria-busy while active is on. Turn active off when the content arrives, or swap the wrapper out.
import { LoadingShimmer } from "@/components/loading-shimmer";
export function CardSkeleton() {
return (
<LoadingShimmer className="rounded-xl border p-4">
<div className="h-3 w-2/3 rounded bg-neutral-200" />
<div className="mt-2 h-3 w-1/3 rounded bg-neutral-200" />
</LoadingShimmer>
);
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | Your placeholder shapes. | |
active | boolean | true | Shows the sweep and sets aria-busy. |
duration | number | 1.6 | Seconds per sweep. |
color | string | "rgba(255,255,255,0.35)" | Colour of the band of light. |
className | string | Classes for the wrapper. |
With reduced motion, the sweep is hidden. The placeholders stay.