Skeleton

A pulsing placeholder for what is loading.

skeleton-demo.tsx
import { Skeleton } from './ui/skeleton.tsx'

export default () => (
  <div style="display: flex; align-items: center; gap: 1rem">
    <Skeleton style="width: 3rem; height: 3rem; border-radius: 9999px" />
    <div style="display: grid; gap: 0.5rem">
      <Skeleton style="width: 15rem; height: 1rem" />
      <Skeleton style="width: 12rem; height: 1rem" />
    </div>
  </div>
)

Installation

dui add skeleton

Or copy ui/skeleton.tsx and ui/skeleton.css into your project, with lib/jsx/jsx-runtime.ts, lib/jsx/jsx-dev-runtime.ts, lib/css.d.ts, and lib/theme.css.

Examples

Card

skeleton-card.tsx
import { Skeleton } from './ui/skeleton.tsx'

export default () => (
  <div style="display: grid; gap: 0.75rem">
    <Skeleton style="width: 15rem; height: 8rem; border-radius: 0.75rem" />
    <Skeleton style="width: 15rem; height: 1rem" />
    <Skeleton style="width: 12rem; height: 1rem" />
  </div>
)

Compared to shadcn/ui