Skip to content

Skeleton Loader

Placeholder shapes that animate with a shimmer effect while content loads. Use to maintain layout structure and reduce perceived loading time.

Preview

Card skeleton

Table row skeleton

Shapes

ShapeCSS classDimensions
Text line.lex-skeleton--text14 px height, fluid width
Heading.lex-skeleton--heading20 px height, 60% width
Avatar.lex-skeleton--avatar40 × 40 px, circular
Image.lex-skeleton--image100% width, 120 px height
Card.lex-skeleton--card300 px max, 160 px height

Props

PropTypeDefaultDescription
shape'text' | 'heading' | 'avatar' | 'image' | 'card''text'Skeleton shape
widthstring | numberautoCustom width
heightstring | numberautoCustom height
countnumber1Number of skeleton lines

Code example

React

tsx
import { Skeleton } from '@thepace/lexicon/components';

<Skeleton shape="avatar" />
<Skeleton shape="heading" />
<Skeleton shape="text" count={3} />

Vanilla HTML

html
<div class="lex-skeleton--row">
  <div class="lex-skeleton lex-skeleton--avatar"></div>
  <div style="flex: 1; display: flex; flex-direction: column; gap: 8px;">
    <div class="lex-skeleton lex-skeleton--heading"></div>
    <div class="lex-skeleton lex-skeleton--text" style="width: 90%;"></div>
    <div class="lex-skeleton lex-skeleton--text" style="width: 75%;"></div>
  </div>
</div>

CSS class reference

ClassPurpose
.lex-skeletonBase styles + shimmer animation
.lex-skeleton--textText line shape
.lex-skeleton--headingHeading shape
.lex-skeleton--avatarCircular avatar shape
.lex-skeleton--imageImage block shape
.lex-skeleton--cardCard-sized block
.lex-skeleton--rowFlex row container

Accessibility

  • Add aria-busy="true" on the container while loading.
  • Add aria-label="Loading content" on the skeleton region.
  • Use role="status" if the loading state is a response to user action.

Guidelines

Do

  • Match skeleton shapes to the actual content layout for smooth transitions.
  • Use width variations on text lines for a realistic appearance.

Don't

  • Don't show skeletons for less than 300 ms — use a spinner or nothing.
  • Don't combine skeleton loaders with spinners in the same view.

Released under the MIT License. A product by the pace.