Code

<!-- pearl-skeleton.free.js: download it from the Install section below and host it with your site -->
<script src="/pearl-skeleton.free.js" defer></script>

<pearl-skeleton shape="card" width="280" theme="light">
  <!-- the real content goes inside; it stays hidden until "loaded" is set -->
  <article id="post"></article>
</pearl-skeleton>

<script>
  const skeleton = document.querySelector('pearl-skeleton');
  fetch('/api/post/42').then((r) => r.text()).then((text) => {
    document.querySelector('#post').textContent = text;
    skeleton.setAttribute('loaded', '');
  });
</script>

In context

A feed: three rows, one beam
Sunset, dashboard tiles Pro

Install · Free Web Component

One file, no dependencies. Aurora preset, every other option included. Host it yourself so your visitors never load anything from our servers.

1. Install with one command — or download the file
shadcn CLI · React
npx shadcn@latest add https://www.ui-design.co/r/pearl-skeleton.json
2. Load it and use the element
HTML
<!-- pearl-skeleton.free.js: download it from the Install section below and host it with your site -->
<script src="/pearl-skeleton.free.js" defer></script>

<pearl-skeleton shape="card" width="280" theme="light">
  <!-- the real content goes inside; it stays hidden until "loaded" is set -->
  <article id="post"></article>
</pearl-skeleton>

<script>
  const skeleton = document.querySelector('pearl-skeleton');
  fetch('/api/post/42').then((r) => r.text()).then((text) => {
    document.querySelector('#post').textContent = text;
    skeleton.setAttribute('loaded', '');
  });
</script>
3. React + TypeScript (optional)

The shadcn command adds a typed React wrapper for you. Using the file directly? Custom elements work in React as-is; for type checking add:

TypeScript
// pearl-skeleton.d.ts
declare namespace JSX {
  interface IntrinsicElements {
    'pearl-skeleton': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
      shape?: 'text' | 'title' | 'avatar' | 'block' | 'card';
      lines?: number | string;
      width?: number | string;
      height?: number | string;
      radius?: number | string;
      loaded?: boolean | '';
      theme?: 'light' | 'dark';
    };
  }
}

Pro · React + TypeScript Pro

One payment of $4.99, yours forever. Use it in unlimited personal and commercial projects; no resale.

  • React component with TypeScript types and the full source
  • Sunset, Mint and Mono tints, plus custom tints from Brand Fit
  • The vanilla Web Component with every tint, a demo page, README and license

Attributes & props

NameTypeDefaultDescription
shape 'text' | 'title' | 'avatar' | 'block' | 'card''text'What it stands in for. card is a ready composition: an avatar, two lines and a block.
lines number3Lines of text for shape="text"; the last one is shorter. Their height follows the font size around the skeleton.
width number (px) | CSS widthparent width (title: 58%)Width of the placeholder and of the revealed content.
height number (px) | CSS heightblock 120, avatar 44Height of a block or a title; the diameter of an avatar.
radius number (px) | CSS radiusby shapeCorner radius of the wells.
loaded booleanoffSet it when the data has arrived: the wells fill with light and dissolve, the children condense out of a blur and the box glides to their height. Remove it to load again.
children elements—The real content. Until loaded it is invisible, inert and hidden from screen readers; the host carries aria-busy="true".
theme 'light' | 'dark''light'Pale wells on a light page or dark ones.
tint Pro'aurora' | 'sunset' | 'mint' | 'mono' | object'aurora'Colours of the beam and of the fill, or a custom tint. Free build ships Aurora only.

Every skeleton on the page shares one clock and takes the beam’s position from where it sits on the page, so a card on the left lights before one on the right and nothing blinks out of step — no wrapper or provider needed. The beam leans a little, so lower rows light slightly later. The host has aria-busy while loading; add your own “Loading…” status text if the region needs announcing. Under prefers-reduced-motion the beam stands still and the content simply fades in. The wells need a little of the page showing round them, so they read best on a plain surface. All CSS and the Web Animations API, no WebGL.

More components