# Skeleton

> Placeholder shapes that hold the layout while content loads.

Use skeletons where content will appear in a known layout, such as a card, a list or table rows, so the page doesn't jump when the data arrives. For a task with measurable progress, use [progress](/docs/components/progress) instead.

Pro example source is available to licensed users. See [Pro access](/docs/pro/access).

## Installation

Pro components install from the Aloxe registry with the shadcn CLI. Once per project, add the registry to `components.json` and put a [registry token](/account/tokens) in the `ALOXE_TOKEN` environment variable. [Registry](/docs/pro/registry) has the details.

```json
{
  "registries": {
    "@aloxe": {
      "url": "https://<aloxe-site>/r/{name}.json",
      "headers": { "Authorization": "Bearer ${ALOXE_TOKEN}" }
    }
  }
}
```

Then add the component:

```bash
npx shadcn@latest add @aloxe/skeleton
```

The CLI copies the source into `components/ui/aloxe/`, so it never overwrites your own `ui` components. It also installs `@aloxe/react`, `@aloxe/tokens` and `@base-ui/react`.

Import the tokens once in your global stylesheet, after Tailwind, and add an `@source` for the copied files and one for `@aloxe/react`, so Tailwind generates their classes. `@source` paths are relative to the stylesheet; these assume `src/app/globals.css` and `src/components/ui/aloxe/`.

```css
@import "tailwindcss";
@import "@aloxe/tokens/aloxe.css";
@import "@aloxe/tokens/tailwind.css";
@source "../components/ui/aloxe";
@source "../../node_modules/@aloxe/react/dist";
```

[Installation](/docs/getting-started/installation) covers the theme and brand attributes.

## Usage

```tsx
import { Suspense } from "react";
import { SkeletonCard } from "@/components/ui/aloxe/skeleton";

<Suspense fallback={<SkeletonCard label="Loading comment" />}>
  <Comment id={id} />
</Suspense>
```

`SkeletonCard` has the border, radius and padding of an outlined `Card`, so it works as a `Suspense` fallback or a `loading.tsx` without a layout shift. For any other layout, compose `Skeleton` shapes and size them with classes to match the content.

## Examples

### Shapes

`text` is one line, `circle` an avatar, `block` an image or a chart. Size each with classes such as `w-2/3`, `size-8` or `h-40`.

Pro example source is available to licensed users. See [Pro access](/docs/pro/access).

### Composed list

Build the loading state of your own layout from shapes, row for row. Wrap the whole region in one `role="status"` with a visually hidden label, rather than labelling each shape.

Pro example source is available to licensed users. See [Pro access](/docs/pro/access).

## Accessibility

| Key | Action |
| --- | --- |
| None | Skeletons aren't focusable. Focus stays where it was until the content arrives. |

- Every `Skeleton` is `aria-hidden`. Announce loading once per region: `SkeletonCard` is a `status` with a hidden label ("Loading" by default), and a composed region needs its own `role="status"`.
- Put `aria-busy` on a table or list while its rows are placeholders.
- The pulse is slow and stops with `prefers-reduced-motion`.

## API reference

Every part accepts `className` and renders a `data-aloxe` attribute you can target in CSS, such as `[data-aloxe="skeleton"]`.

**Skeleton** (extends <span aria-hidden>)

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `shape` | `"text" \| "circle" \| "block"` | `"text"` |  | text is one 16 px line, circle a 40 px round, block a 96 px tall area. |
| `className` | `string` |  |  | Sizes the placeholder to match what loads, such as w-1/2, size-8 or h-40. |

**SkeletonCard** (extends <div role="status">)

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `avatar` | `boolean` | `true` |  | Shows a circle and two short lines at the top, like a card header with an avatar. |
| `lines` | `number` | `3` |  | Number of body text lines. The last one is shorter. |
| `label` | `ReactNode` | `"Loading"` |  | Announced to screen readers while the card is shown. |
| `className` | `string` |  |  | Merged with the default classes. |

## Figma

Matches the **Skeleton** and **Skeleton card** components in the Pro Figma file. Skeleton `Shape` (`Text`, `Circle`, `Block`) maps to `shape`.

See [Figma](/docs/getting-started/figma) for where to get the file and how its names map to code.

## Pro

Skeleton is part of Aloxe Pro. The previews on this page are open to everyone; the Code tab shows the example source once you sign in with a Pro license. See [Access and licenses](/docs/pro/access) and [Pricing](/pricing#pro).
