Skip to Content
zjkm-ui
Components

Loading Shimmer

A shimmer for loading placeholders.

Props
1.6s
<LoadingShimmer>
  <CardSkeleton />
</LoadingShimmer>

Installation

npx shadcn@latest add https://ui.zjkm.tech/r/loading-shimmer.json
import { 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

PropTypeDefaultDescription
childrenReactNodeYour placeholder shapes.
activebooleantrueShows the sweep and sets aria-busy.
durationnumber1.6Seconds per sweep.
colorstring"rgba(255,255,255,0.35)"Colour of the band of light.
classNamestringClasses for the wrapper.

With reduced motion, the sweep is hidden. The placeholders stay.

On this page