Skeleton

Loading placeholders: Skeleton blocks in rect, circle or text shapes with a gradient shimmer, SkeletonText paragraphs with a natural short last line, and SkeletonSwap, which cross-fades from skeleton to real content in one grid cell and holds the last measured height on reload so nothing jumps; reduced motion swaps the shimmer for an opacity pulse.

Preview

Skeleton preview width

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @karaui/skeleton
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

API Reference

Skeleton

shape?
"text" | "circle" | "rect"
rect
width?
string | number

CSS width (number = px). Text defaults to 100%, circles to 40px.

—
height?
string | number

CSS height (number = px). Circles default to their width.

—
shimmer?
boolean

Sweep a highlight across the block. Reduced motion swaps it for a pulse.

true
className?
string
—
style?
CSSProperties
—

SkeletonText

lines?
number

Number of lines.

3
lastLineWidth?
string | number

Width of the final line, so the block reads like a real paragraph.

62%
gapClassName?
string

Gap between lines (Tailwind class).

gap-2
lineClassName?
string
—
shimmer?
boolean
true
className?
string
—

SkeletonSwap

loading
boolean

While true the skeleton shows; flip to false to cross-fade to children.

—
skeleton
ReactNode

Placeholder rendered while loading — mirror the real content's shape.

—
children?
ReactNode

Real content. May be absent while loading.

—
keepHeight?
boolean

Keep the last measured content height while reloading, so a reload never collapses the box to the skeleton's height. Default true.

true
loadingLabel?
string

Announced to screen readers while loading.

Loading
className?
string
—

Updated