Components
Skeleton
Placeholder shapes for content that is loading.
Server-compatible (no "use client")
import.tsx
skeleton-loading.tsx
Edit on GitHubPurpose
Skeleton shows the approximate shape of content while it loads.
Import
import { Skeleton } from "@neshel-ui/components";Usage
Preview: skeleton-loading
import { Skeleton } from "@neshel-ui/components";
import { Inline, Stack } from "@neshel-ui/layout";
export default function SkeletonLoading() {
return (
// The region announces its busy state; the skeletons themselves are aria-hidden.
<section aria-busy="true" aria-label="Loading profile">
<Stack space="4">
<Inline space="3" alignY="center">
<Skeleton shape="circle" width={48} />
<Stack space="2" className="flex-1">
<Skeleton shape="text" width="60%" />
<Skeleton shape="text" width="40%" />
</Stack>
</Inline>
<Skeleton height={96} />
</Stack>
</section>
);
}API
SkeletonProps
| Prop | Type | Default | Description |
|---|---|---|---|
| height | number | string | — | Block size; numbers are pixels. |
| ref | Ref<HTMLSpanElement> | — | — |
| shape | "rectangle" | "circle" | "text" | "rectangle" | Placeholder shape (default "rectangle"). |
| width | number | string | — | Inline size; numbers are pixels. |
Also accepts the props of: React DOM attributes.
width and height accept numbers (pixels) or CSS lengths. The pulse animation stops under
prefers-reduced-motion: reduce.
Accessibility
Skeletons are always aria-hidden="true". Mark the loading region with aria-busy="true" and a
label, and announce completion if it matters.
Common mistakes
- Expecting a skeleton to announce "loading": it is invisible to assistive technology by design.