Skeleton
⋯
Skeleton is a visual placeholder, not the content itself. Its tone prop maps to the Neutral and Teal tones of the Figma .Skeleton Line.
import { Skeleton } from "@nesra/ui/skeleton";
export function LoadingTitle() { return <Skeleton className="w-48" />;}Skeleton is also exported from @nesra/ui.
Examples
Section titled “Examples”Text widths
Section titled “Text widths”Use width classes for lines of different lengths. Widths are explicit and stable, so the loading layout stays predictable.
import { Skeleton } from "@nesra/ui/skeleton";
export function SkeletonWidthsExample() { return ( <output aria-busy="true" aria-label="Article excerpt" className="grid w-72 gap-2"> <span className="sr-only">Loading article excerpt</span> <Skeleton /> <Skeleton className="w-5/6" /> <Skeleton className="w-2/3" /> <Skeleton className="w-1/2" /> </output> );}Heights
Section titled “Heights”Use height classes to match the line height of the content that will replace each placeholder. The default height is 16px.
import { Skeleton } from "@nesra/ui/skeleton";
export function SkeletonHeightsExample() { return ( <output aria-busy="true" aria-label="Text sizes" className="grid w-72 gap-4"> <span className="sr-only">Loading text</span> <Skeleton className="h-3" /> <Skeleton /> <Skeleton className="h-6" /> <Skeleton className="h-8" /> </output> );}Shapes
Section titled “Shapes”Use rounded-full for a circular avatar placeholder or a rounding class for a rectangular surface.
import { Skeleton } from "@nesra/ui/skeleton";
export function SkeletonShapesExample() { return ( <output aria-busy="true" aria-label="Content shapes" className="flex items-center gap-4"> <span className="sr-only">Loading content</span> <Skeleton className="size-12 rounded-full" /> <Skeleton className="size-12 rounded-md" /> <Skeleton className="h-12 w-24 rounded-lg" /> </output> );}Loading profile
Section titled “Loading profile”Compose placeholders to approximate the space the content will occupy. Replace the entire loading region with real content when it arrives.
import { Skeleton } from "@nesra/ui/skeleton";
export function SkeletonProfileExample() { return ( <output aria-busy="true" aria-label="Profile" className="flex w-72 items-center gap-3"> <span className="sr-only">Loading profile</span> <Skeleton className="size-10 shrink-0 rounded-full" /> <div className="grid flex-1 gap-2"> <Skeleton className="w-3/4" /> <Skeleton className="h-3 w-1/2" /> </div> </output> );}Card loading state
Section titled “Card loading state”Match the eventual card’s image and text areas to limit layout shift when content arrives.
import { Skeleton } from "@nesra/ui/skeleton";
export function SkeletonCardExample() { return ( <output aria-busy="true" aria-label="Article card" className="grid w-72 gap-4 rounded-lg border border-nesra-stroke-border bg-nesra-surface-card-bg-neutral p-4" > <span className="sr-only">Loading article card</span> <Skeleton className="h-32 rounded-md" /> <div className="grid gap-2"> <Skeleton className="h-5 w-2/3" /> <Skeleton /> <Skeleton className="w-4/5" /> </div> </output> );}List loading state
Section titled “List loading state”Repeat a small composition for rows while the application loads a list. The row count here is illustrative, not a Skeleton prop.
import { Skeleton } from "@nesra/ui/skeleton";
export function SkeletonListExample() { return ( <output aria-busy="true" aria-label="Team members" className="grid w-72 gap-4"> <span className="sr-only">Loading team members</span> {["first", "second", "third"].map((row) => ( <div className="flex items-center gap-3" key={row}> <Skeleton className="size-8 shrink-0 rounded-full" /> <div className="grid flex-1 gap-2"> <Skeleton className="w-2/3" /> <Skeleton className="h-3 w-1/2" /> </div> </div> ))} </output> );}tone="neutral" uses Foundation/bg-disabled for white surfaces. tone="teal" uses
Categorical/Teal/subtle-hover for AI content on a Categorical/Teal/subtle surface. Figma’s
.Skeleton Line is 10px high with radius-xs, which the example sets with h-2.5 rounded-nesra-xs.
import { Skeleton } from "@nesra/ui/skeleton";
export function SkeletonToneExample() { return ( <div className="grid w-full max-w-sm gap-4"> <output aria-busy="true" aria-label="Summary" className="grid gap-1.5"> <span className="sr-only">Loading summary</span> <Skeleton className="h-2.5 rounded-nesra-xs" /> <Skeleton className="h-2.5 w-2/3 rounded-nesra-xs" /> </output> <output aria-busy="true" aria-label="AI insight" className="grid gap-1.5 rounded-nesra-sm bg-nesra-categorical-teal-subtle px-3 py-2" > <span className="sr-only">Loading AI insight</span> <Skeleton className="h-2.5 rounded-nesra-xs" tone="teal" /> <Skeleton className="h-2.5 w-2/3 rounded-nesra-xs" tone="teal" /> </output> </div> );}Light and Dark
Section titled “Light and Dark”Skeleton uses Foundation/bg-disabled (--nesra-foundation-bg-disabled), which is gray-100 in
Light and gray-800 in Dark, so the placeholder follows the page theme through .dark or
data-theme="dark". The Teal tone uses Categorical/Teal/subtle-hover, which is teal-100 in Light
and teal-900 in Dark.
Accessibility
Section titled “Accessibility”Skeleton has aria-hidden="true" and does not announce loading by itself. Provide a visible or screen-reader-only loading message in a named status region, as shown above. Set aria-busy on the region while loading and remove it when real content replaces the placeholders. The pulse animation stops when the user prefers reduced motion.
API reference
Section titled “API reference”| Prop | Type | Default | Description |
|---|---|---|---|
tone |
"neutral" | "teal" |
"neutral" |
Fill color. teal is for AI loading states on Teal surfaces. |
className |
string |
— | Tailwind classes for width, height, shape, or other visual overrides. |
Skeleton forwards other native div props and its ref points to the div. It does not accept children or an aria-hidden override. By default, it is full width, 16px high, and has medium rounding. The neutral background uses bg-nesra-foundation-bg-disabled and the Teal background uses bg-nesra-categorical-teal-subtle-hover from the semantic color roles.