Skip to Content
Neshel-UI
Components

Skeleton

Placeholder shapes for content that is loading.

Server-compatible (no "use client")

Purpose

Skeleton shows the approximate shape of content while it loads.

Import

import.tsx
import { Skeleton } from "@neshel-ui/components";

Usage

Preview: skeleton-loading
Preview theme
skeleton-loading.tsx
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

SkeletonProps
PropTypeDefaultDescription
heightnumber | string—Block size; numbers are pixels.
refRef<HTMLSpanElement>——
shape"rectangle" | "circle" | "text""rectangle"Placeholder shape (default "rectangle").
widthnumber | 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.
Edit on GitHub

On this page