bx

Skeleton

Use to show a placeholder while content is loading.

tsx
<div className="flex items-center gap-4">
  <Skeleton className="h-12 w-12 rounded-full" />
  <div className="space-y-2">
    <Skeleton className="h-4 w-[250px]" />
    <Skeleton className="h-4 w-[200px]" />
  </div>
</div>

Skeleton is a pulsing gray placeholder for content that is still loading. Use shapes that match the geometry of the real content (round avatar, h-4 title, h-3 line of text).

Compared with Spinner: Skeleton is a placeholder for the final layout, Spinner only says "something is loading somewhere".

Installation

Terminal
$ bext ui add skeleton

Usage

tsx
import { Skeleton } from "@bext-stack/ui/primitives"

<div className="flex items-center gap-4">
  <Skeleton className="h-12 w-12 rounded-full" />
  <div className="space-y-2">
    <Skeleton className="h-4 w-[250px]" />
    <Skeleton className="h-4 w-[200px]" />
  </div>
</div>

Anatomy

<Skeleton className="h-4 w-full rounded-md" />

API Reference

Skeleton

Prop Type Default Description
className string — Default: rounded-md bg-muted animate-pulse. Add h-N w-N to size it.

Accessibility

Wrap the container that holds the skeletons with aria-busy="true" aria-live="polite" to tell assistive technologies that the content is loading.

Try it live Open in play

Edit this example live in the bext playground. It compiles and runs entirely in your browser.

src/app/page.tsx 1 file · react · runs in your browser
The React idiom: same UI, for comparison.