Skip to the content

Skeleton

Skeleton draws an animated (shimmer) placeholder in the shape of content that is still loading. You describe the geometry with the Rect and Circle primitives; Skeleton adds the animation and the theme colors. width and height are required: they set the SVG viewBox your shapes are drawn in.
Feedback & Loading

When to use

Use when
  • The layout of the incoming content is known: a list, a card, a header.
  • A table cell or label is waiting for its value — use TextPreset.
Avoid when
  • The shape of the result is unpredictable — use Spinner.
  • The load is too short to notice; a flashing placeholder is worse than none.
  • The whole screen lacks a clear hierarchy; a page of grey blocks confuses more than it helps.

Usage

Loading...
import { Circle } from '@apollion-dsi/core/scenario/circle-component';
import { Rect } from '@apollion-dsi/core/scenario/rect-component';
import { Skeleton } from '@apollion-dsi/core/skeleton/composed-skeleton';

<Skeleton width={300} height={100}>
  <Circle cx={50} cy={50} r={30} />
  <Rect x={100} y={35} width={200} height={13} />
  <Rect x={100} y={55} width={200} height={13} />
</Skeleton>;

Colors

The base color defaults to the theme's muted and the shimmer to edge.border. Both accept theme color tokens.

Loading...
<Skeleton width={200} height={20} backgroundColor="primary.light" foregroundColor="primary.base">
  <Rect x={0} y={0} width={200} height={20} />
</Skeleton>

Text lines

TextPreset is a one-line Skeleton: a single Rect that fills width (any CSS width, default '100%') × height (default 13); it needs no children. Stack several to suggest a paragraph.

Loading...Loading...Loading...
import { TextPreset } from '@apollion-dsi/core/skeleton/text-preset';

{
  isLoading ? <TextPreset width={240} /> : <Text text={title} />;
}

Presets

Four ready-made shapes cover common cases. They use the library's built-in colors, not the theme tokens; pass backgroundColor/foregroundColor as CSS colors to change them.

ListPresetSkeleton

Loading...

BulletListPresetSkeleton

Loading...

CodePresetSkeleton

Loading...

ItemPresetSkeleton

Loading...

Accessibility

  • Renders an SVG with role="img" named by a <title> (default 'Loading...'). Pass title to localize it.
  • Mark the region that is loading with aria-busy="true" and clear it when the content arrives.

Properties

See also