# Skeleton

A loading placeholder with content-shaped geometry.

A loading placeholder with content-shaped geometry.

```tsx
import { Skeleton, Stack } from "@zentara-co/zenos-ui";

function SkeletonVariantsExample() {
  return (
    <Stack direction="row" align="center" gap="5" wrap="wrap">
      <Skeleton shape="rectangle" className="h-16 w-36" />
      <Skeleton shape="text" className="w-40" />
      <Skeleton shape="circle" className="size-16" />
    </Stack>
  );
}
```

## Import

```tsx
import { Skeleton } from "@zentara-co/zenos-ui";
```

## Content-shaped placeholders

Build loading layouts from the same rough geometry as the content they replace. This reduces layout shift and helps users understand what kind of information is arriving.

```tsx
import { Skeleton, Stack, VisuallyHidden } from "@zentara-co/zenos-ui";

function SkeletonCardExample() {
  return (
    <div className="w-full max-w-md rounded-lg border border-border-default p-4" aria-busy="true">
      <VisuallyHidden>Loading workspace summary</VisuallyHidden>
      <Stack gap="4">
        <Stack direction="row" gap="3" align="center">
          <Skeleton shape="circle" className="size-12 shrink-0" />
          <Stack gap="2" className="min-w-0 flex-1">
            <Skeleton shape="text" className="w-2/5" />
            <Skeleton shape="text" className="w-3/5" />
          </Stack>
        </Stack>
        <Skeleton className="h-32 w-full" />
        <Stack gap="2">
          <Skeleton shape="text" className="w-full" />
          <Skeleton shape="text" className="w-4/5" />
        </Stack>
      </Stack>
    </div>
  );
}
```

## Repeated content

Keep repeated placeholders simple and consistent with the loaded rows. Small width changes can suggest natural text variation without making the loading surface visually noisy.

```tsx
import { Skeleton, Stack, VisuallyHidden } from "@zentara-co/zenos-ui";

function SkeletonListExample() {
  return (
    <Stack gap="1" className="w-full max-w-lg" aria-busy="true">
      <VisuallyHidden>Loading recent activity</VisuallyHidden>
      {Array.from({ length: 4 }, (_, index) => (
        <Stack
          key={index}
          direction="row"
          gap="3"
          align="center"
          className="border-b border-border-default px-2 py-3 last:border-0"
        >
          <Skeleton shape="circle" className="size-9 shrink-0" />
          <Stack gap="2" className="min-w-0 flex-1">
            <Skeleton shape="text" className={index % 2 === 0 ? "w-2/3" : "w-1/2"} />
            <Skeleton shape="text" className="w-1/3" />
          </Stack>
          <Skeleton className="h-7 w-16 shrink-0" />
        </Stack>
      ))}
    </Stack>
  );
}
```

## Loading state

Skeleton is visual and always hidden from assistive technology. Put `aria-busy` on the region being updated and provide concise status text when loading begins. Replace the entire placeholder composition with real content when the request completes.

```tsx
import { Button, Skeleton, Stack, Text, VisuallyHidden } from "@zentara-co/zenos-ui";
import { useState } from "react";

function SkeletonLoadingStateExample() {
  const [loading, setLoading] = useState(true);

  return (
    <Stack gap="4" className="w-full max-w-md">
      <Button variant="primary" onClick={() => setLoading((current) => !current)}>
        {loading ? "Show loaded content" : "Reload content"}
      </Button>
      <div aria-busy={loading} aria-live="polite" className="min-h-24 rounded-lg border p-4">
        {loading ? (
          <Stack gap="3">
            <VisuallyHidden>Loading policy details</VisuallyHidden>
            <Skeleton shape="text" className="w-1/3" />
            <Skeleton shape="text" className="w-full" />
            <Skeleton shape="text" className="w-4/5" />
          </Stack>
        ) : (
          <Stack gap="1">
            <Text weight="medium">Access policy</Text>
            <Text color="subtle">
              Workspace administrators can approve requests for protected resources.
            </Text>
          </Stack>
        )}
      </div>
    </Stack>
  );
}
```

## Custom styling

Use `className` to override the surface color, corner radius, and dimensions. Prefer semantic
tokens so custom placeholders remain visible across themes. The built-in pulse and reduced-motion
behavior remain unless the application explicitly overrides the animation.

```tsx
import { Skeleton, Stack, VisuallyHidden } from "@zentara-co/zenos-ui";

function SkeletonCustomExample() {
  return (
    <Stack
      gap="4"
      className="w-full max-w-md rounded-xl bg-background-accent-purple-subtlest-default p-4"
      aria-busy="true"
    >
      <VisuallyHidden>Loading campaign summary</VisuallyHidden>
      <Stack direction="row" gap="3" align="center">
        <Skeleton
          shape="circle"
          className="size-11 shrink-0 bg-background-accent-purple-subtle-default"
        />
        <Stack gap="2" className="min-w-0 flex-1">
          <Skeleton shape="text" className="h-3 w-2/5 bg-background-accent-purple-subtle-default" />
          <Skeleton shape="text" className="h-3 w-3/5 bg-background-accent-purple-subtle-default" />
        </Stack>
      </Stack>
      <Skeleton className="h-24 w-full rounded-lg bg-background-accent-purple-subtle-default" />
    </Stack>
  );
}
```

## Sizing

Shapes define geometry, not dimensions. Use layout utilities through `className` to match the eventual content: width for text, width and height for rectangles, and one square dimension for circles.

## Variants

rectangle, text, circle

## API

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| shape | rectangle \| text \| circle | rectangle | Placeholder geometry. |
| native props | React.HTMLAttributes<HTMLDivElement> | — | Forwards native attributes, events, aria-*, data-*, className, style, and ref. |

Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props, including className, style, aria-*, and data-*.

## Accessibility

Every Skeleton has `aria-hidden="true"` because placeholder geometry is not meaningful content. Announce loading from the surrounding region and avoid placing interactive controls inside a skeleton. The pulse animation follows the application's reduced-motion CSS behavior; loading must remain understandable without motion.

Source: https://zenos-ui.pages.dev/components/skeleton/