Skip to content

Installation

Copy page
Terminal window
npm install dotquilt

For React, add the adapter too:

Terminal window
npm install @dotquilt/react

Each component has its own entry point, so you only ship what you use. Register them once, before they appear on the page.

import { registerLoadingRegion } from 'dotquilt/region';
import { registerSkeletonText } from 'dotquilt/skeleton';
registerLoadingRegion();
registerSkeletonText();

To register every component at once, call registerAll() from dotquilt/register-all.

LoadingRegion loads its reveal animation on its own, the first time a region shows its placeholder, so it doesn’t weigh on the first page load. Bundlers such as Vite and webpack split it into its own file. If the data arrives before that file has loaded, that one handover uses the simpler dissolve.

<dotquilt-region state="pending" aria-label="Quarterly revenue">
<dotquilt-skeleton-text slot="placeholder" lines="3"></dotquilt-skeleton-text>
<article>…your content…</article>
</dotquilt-region>

When the data arrives, fill in your content and set the state:

const region = document.querySelector('dotquilt-region');
region?.update({ state: 'ready' });

Give each region a label, so assistive technology can name what is loading.

For a complete component with a real request, errors and stale answers, see the usage example on the Skeleton page.