# Skeleton

- Page: https://jiguang132.com/resources/astryx/docs/skeleton
- Resource: Astryx (https://jiguang132.com/resources/astryx.md)
- All guides: https://jiguang132.com/resources/astryx/docs.md

An animated shimmer placeholder that previews the shape of content while it loads. Use it to build loading screens that match the layout of the real content. For content with unknown dimensions, use Spinner instead.

## Installation

```bash
npm install @astryxdesign/core@0.7.1 @astryxdesign/theme-neutral@0.7.1 @stylexjs/stylex@0.19.0
```

Requires React 19+, base CSS and a Theme provider. See [Setup](/resources/astryx/docs/getting-started).

## Skeleton

An animated shimmer placeholder that previews the shape of content while it loads. Use it to build loading screens that match the layout of the real content. For content with unknown dimensions, use Spinner instead.

| Prop | Type | Default | Description |
|---|---|---|---|
| width | number \| string | '100%' | Width in pixels (number) or CSS value (string). |
| height | number \| string | '100%' | Height in pixels (number) or CSS value (string). |
| radius | 'none' \| 0 \| 1 \| 2 \| 3 \| 4 \| 'rounded' | 3 | Border radius using design token scale. Use none for sharp corners, rounded for fully rounded (avatars, pills, circles). |
| index | number | 0 | Index for staggered animation timing. For element at index n, animation starts at DELAY_TIME + (STAGGER_TIME × n). |

### Usage guidance

- Match the size and shape of the content being loaded to create a realistic placeholder.
- Stagger multiple skeletons with the `index` prop for a natural wave animation.
- Avoid: Use when the content dimensions are unknown; use Spinner instead.
- Avoid: Combine with a Spinner on the same content area; pick one loading pattern.
- Avoid: Show skeletons indefinitely; if loading takes too long, show an error or empty state instead.

### Theming API

```json
{
  "targets": [
    {
      "className": "astryx-skeleton"
    }
  ]
}
```

### Anatomy

- **Placeholder**: Painted shape that stands in for content while it loads.


## Examples

- Skeleton: A skeleton loading placeholder.
- Skeleton — Card Loading: Card skeleton with avatar, name, and content lines.
- Skeleton — Staggered List: Staggered skeleton lines with varying widths.
- Skeleton — Table Rows: Table skeleton with staggered column widths.

---

Index of all JGuang resources: https://jiguang132.com/llms.txt
