JGuang

Skeleton

Skeleton · Astryx

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

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.

Installation

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.

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.

PropTypeDefaultDescription
widthnumber | string'100%'Width in pixels (number) or CSS value (string).
heightnumber | string'100%'Height in pixels (number) or CSS value (string).
radius'none' | 0 | 1 | 2 | 3 | 4 | 'rounded'3Border radius using design token scale. Use none for sharp corners, rounded for fully rounded (avatars, pills, circles).
indexnumber0Index 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

{
  "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.