Skip to content
Haze UI

Skeleton

Loading placeholder in line, circle or block shape with a shimmer, a pulse or no animation; stacked lines end with a shorter one.

pnpm dlx shadcn@latest add @haze/skeleton
Open preview in a new tab
Liveno JavaScript

When to use

  • Reserving space for a card, list row or profile header while data loads
  • Matching the final layout so the page does not jump when content arrives
  • Showing a text paragraph shape with lines set to 3

When not to use

  • The wait is a short action such as a button press; use a spinner or disabled state
  • Loading failed; show an error message instead of a pulsing shape

Installation

Add the Haze registry to components.json once, then install Skeleton with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/skeleton
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
variant"line" | "circle" | "block""line"Shape: text line, round avatar, or rectangular block.
linesnumber1Number of text lines for the line variant; the last is two thirds wide.
animation"shimmer" | "pulse" | "none""shimmer"shimmer sweeps a highlight across the shape, pulse fades it in and out, none leaves it still.
classstring–Sizing and spacing, for example h-6 w-40 or size-12.

Accessibility

  • With several lines, the last line is shorter so the block reads as a paragraph.
  • Marked aria-hidden="true" because the shapes carry no information.
  • Announce the loading state elsewhere, for example aria-busy="true" on the container or a visually hidden status text.
  • The shimmer and the pulse are CSS animations; the theme's global reduced-motion rule stops them for users who ask for less motion.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • Install and use

    Install the Haze UI component "Skeleton" with `npx shadcn@latest add @haze/skeleton`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import Skeleton from "@/components/haze/ui/skeleton.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/ui/skeleton.md

  • Customize with real content

    Adapt the Haze skeleton ui for our product. Replace the demo values of these props with our real content: variant, lines, animation, class. Keep the layout, the heading level rules and these accessibility details: With several lines, the last line is shorter so the block reads as a paragraph. Marked aria-hidden="true" because the shapes carry no information. Announce the loading state elsewhere, for example aria-busy="true" on the container or a visually hidden status text. The shimmer and the pulse are CSS animations; the theme's global reduced-motion rule stops them for users who ask for less motion. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using skeleton, check it fits: use it when reserving space for a card, list row or profile header while data loads; matching the final layout so the page does not jump when content arrives; showing a text paragraph shape with lines set to 3. Avoid it when the wait is a short action such as a button press; use a spinner or disabled state; loading failed; show an error message instead of a pulsing shape. Alternatives: @haze/placeholder.

Dependencies

  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog