# Installation

> Install dotquilt with npm or Bun, add @dotquilt/react for React 19, and register only the components you use.

## Install

**npm**

    ```sh
    npm install dotquilt
    ```

**bun**

    ```sh
    bun add dotquilt
    ```

For React, add the adapter too:

```sh
npm install @dotquilt/react
```

## Register the components

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

**Native**

    ```ts
    import { registerLoadingRegion } from 'dotquilt/region';
    import { registerSkeletonText } from 'dotquilt/skeleton';

    registerLoadingRegion();
    registerSkeletonText();
    ```

**React**

    The React components register themselves. Import them from the adapter:

    ```tsx
    import { LoadingRegion, SkeletonText } from '@dotquilt/react';
    ```

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.

## Show a placeholder

**Native**

    ```html
    <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:

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

**React**

    ```tsx
    <LoadingRegion
      state={data ? 'ready' : 'pending'}
      aria-label="Quarterly revenue"
      placeholder={<SkeletonText lines={3} />}
    >
      <article>…your content…</article>
    </LoadingRegion>
    ```

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](/docs/components/skeleton/#usage) page.
