Astryx

Astryx Skeleton

Component

About

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. Astryx by Meta. Source: https://astryx.atmeta.com/components/Skeleton

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Astryx Skeleton to your project and fits it to your theme.

Code

How Astryx Skeleton is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

'use client';

/* Copyright (c) 2026 Meta Platforms, Inc. See the MIT notice in astryx-skeleton.tsx. */

import '@/components/ui/astryx-skeleton-utils/astryx-preview.css';
import '@astryxdesign/theme-neutral/fonts.css';
import {useSyncExternalStore} from 'react';
import {Theme} from '@astryxdesign/core/theme';
import {neutralTheme} from '@astryxdesign/theme-neutral/built';

import {Skeleton} from '@/components/ui/astryx-skeleton';
import {HStack, VStack} from '@astryxdesign/core/Layout';

function OfficialSample() {
  return (
    <VStack gap={4} width={300}>
      <HStack gap={4} vAlign="center">
        <Skeleton width={64} height={64} radius="rounded" index={0} />
        <VStack gap={2}>
          <Skeleton width={160} height={20} index={1} />
          <Skeleton width={80} height={16} index={2} />
        </VStack>
      </HStack>
      <VStack gap={2}>
        <Skeleton width="90%" height={16} index={3} />
        <Skeleton width="100%" height={16} index={4} />
        <Skeleton width="75%" height={16} index={5} />
      </VStack>
    </VStack>
  );
}

function readPreviewMode() {
  const {classList} = document.documentElement;
  return classList.contains('dark') ? 'dark' : 'light';
}

function subscribeToPreviewMode(callback: () => void) {
  const observer = new MutationObserver(callback);
  observer.observe(document.documentElement, {attributes: true, attributeFilter: ['class']});
  return () => observer.disconnect();
}

export default function Demo() {
  const mode = useSyncExternalStore(subscribeToPreviewMode, readPreviewMode, () => 'light' as const);
  return (
    <Theme theme={neutralTheme} mode={mode}>
      <div className="astryx-demo">
        <div className="astryx-demo-content" data-centered style={{maxWidth: 300}}>
          <OfficialSample />
        </div>
      </div>
    </Theme>
  );
}

Dependencies

More by Astryx

View all
  • Astryx Banner

    Astryx Banner

    61
  • Astryx Avatar

    Astryx Avatar

    34
  • Astryx Aspect Ratio

    Astryx Aspect Ratio

    32
  • Astryx Badge

    Astryx Badge

    30
  • Astryx Button Group

    Astryx Button Group

    29
  • Astryx Chat Composer Drawer

    Astryx Chat Composer Drawer

    27
  • Astryx Toggle Button

    Astryx Toggle Button

    17
  • Astryx Chat Tokenized Text

    Astryx Chat Tokenized Text

    12