Skeleton

Placeholder shaped like the content it stands in for. A soft highlight sweeps across; with reduced motion it is a still block. Layout.

Open playground

About

Skeleton is a React component in the Layout category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { Skeleton } from "@ashutoshswamy/smoui" and set variant, width, lines among its 4 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { Skeleton } from "@ashutoshswamy/smoui";

<div aria-busy="true">
  <Skeleton variant="circle" height={48} />
  <Skeleton variant="text" lines={3} />
  <Skeleton height={96} radius={16} />
</div>

Props 4

variant

Text draws lines (the last shorter), circle is round, rect is a block.

"text""circle""rect"default "rect"
width / height

Size. Text height is per line.

numberstring
lines

Lines for text.

numberdefault 3
radius

Corner radius for rect.

numberdefault 12