# Skeleton

> Bones drawn from the content itself, one shine across them all. When it loads, a soft edge sweeps down and turns each bone into its line; late images keep theirs.

Feedback & loading · skeleton, loading, placeholder, card · HTML, CSS, vanilla JS · no dependencies · updated 2026-10-16
Demo: https://kodza.dev/components/skeleton-loader/

## Files

The code below, served as files: byte for byte what the Kodza site copies (the CSS includes its theme guard).

- [`kodza-skeleton-loader.css`](https://kodza.dev/registry/skeleton-loader/kodza-skeleton-loader.css) · 14.5 KB
- [`kodza-skeleton-loader.js`](https://kodza.dev/registry/skeleton-loader/kodza-skeleton-loader.js) · 9.1 KB
- [`kodza-skeleton-loader.html`](https://kodza.dev/registry/skeleton-loader/kodza-skeleton-loader.html) · 1.8 KB · the markup, to adapt and paste into your page

**Can you run shell commands? Download the CSS and the JS, don't retype them.** Retyping costs thousands of tokens and can drop or change lines of the CSS. Put the files where your stack expects them (Use it says where: change the `-o` paths):

```bash
curl -fsSL --create-dirs -o kodza/kodza-skeleton-loader.css https://kodza.dev/registry/skeleton-loader/kodza-skeleton-loader.css
curl -fsSL --create-dirs -o kodza/kodza-skeleton-loader.js https://kodza.dev/registry/skeleton-loader/kodza-skeleton-loader.js
```

Then load the files from your page as Use it shows, instead of pasting the content. The HTML is the part you adapt (text, links, modifiers): paste it from the Code section. Copy the CSS and the JS from the Code section only if you can't run commands, exactly as they are. (Windows PowerShell: `curl.exe`.)

## API

- Root: `.kodza-skeleton`
- Variables (set them on the root element itself: it declares its own defaults):
  - `--kz-skel-bg: #ffffff`
  - `--kz-skel-fg: #0a0a0a`
  - `--kz-skel-muted: rgba(10, 10, 10, 0.62)`
  - `--kz-skel-border: rgba(10, 10, 10, 0.1)`
  - `--kz-skel-bone: #ededeb`
  - `--kz-skel-shine: rgba(255, 255, 255, 0.85)`
  - `--kz-skel-speed: 1.6s`
  - `--kz-skel-radius: 16px`
  - `--kz-skel-pad: 28px`
- Modifiers: `.kodza-skeleton--card`, `.kodza-skeleton--list`
- Attributes:
  - `data-bone` (e.g. `block`)
  - `data-loading`
- Lifecycle: `kodza:init` / `kodza:destroy` on `document`, with `{ detail: { root } }` to target a container.

## Dark mode

The values Kodza uses on a dark background (`#0a0a0a`). For a page that follows the system theme, add them after the component's CSS:

```css
@media (prefers-color-scheme: dark) {
  .kodza-skeleton {
    --kz-skel-bg: #161616;
    --kz-skel-fg: #f2f2f0;
    --kz-skel-muted: rgba(242, 242, 240, 0.62);
    --kz-skel-border: rgba(255, 255, 255, 0.12);
    --kz-skel-bone: #232323;
    --kz-skel-shine: rgba(255, 255, 255, 0.07);
  }
}
```

A site with its own theme switch puts the same rules under its dark selector instead (`[data-theme="dark"] .kodza-skeleton { … }`); a single dark section, under that section's class.

Its images have dark versions next to them (`kz-steps-1400.webp` → `kz-steps-dark-1400.webp`). To swap them on a dark page: `<picture><source media="(prefers-color-scheme: dark)" srcset="…-dark-….webp"><img …></picture>`.

## Use it

### Plain HTML page

- CSS: `kodza/kodza-skeleton-loader.css` next to the page (the Files commands as they are), linked in `<head>`: `<link rel="stylesheet" href="kodza/kodza-skeleton-loader.css">`. Without a shell, paste it in a `<style>` in `<head>` instead. It only touches `kodza-` classes.
- HTML: where the component goes. Paste it as many times as you need: instances never interfere.
- JS: `kodza/kodza-skeleton-loader.js`, loaded with `<script src="kodza/kodza-skeleton-loader.js" defer></script>` in `<head>`. Without a shell, paste it in a `<script>` before `</body>` (or in `<head>`: it waits for the page). One copy per page, whatever the number of instances.
- Restyle with the `--kz-…` variables, set on the component's root element itself (the root declares its own defaults, so a value on an ancestor is ignored), and with the modifiers / attributes listed under API.
- Font: it takes the page's own. The Kodza look is Geist: `<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap">`.
- Content added later (AJAX navigation, a SPA route, a builder preview): start it with `document.dispatchEvent(new CustomEvent('kodza:init', { detail: { root: container } }))`; before removing it, the same call with `'kodza:destroy'` stops it and puts the original markup back.

### Claude artifact (claude.ai)

- Paste the CSS in a `<style>` and the JS in a `<script>` at the end, in the artifact itself: it loads stylesheets only from Google Fonts and scripts only from a few CDNs, so no `<link>` or `<script src>` to Kodza.
- Writing the artifact file with a shell? Insert the downloaded files (Files) with a command instead of retyping them: a line `KODZA-CSS` alone inside the `<style>`, `KODZA-JS` inside the `<script>`, then `sed -e '/^KODZA-CSS$/{r kodza/kodza-skeleton-loader.css' -e 'd' -e '}' -e '/^KODZA-JS$/{r kodza/kodza-skeleton-loader.js' -e 'd' -e '}' page.html > artifact.html`.
- Font: load Geist from Google Fonts (allowed): `<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap">`.
- Images: the artifact blocks every other host, `kodza.dev` included, without an error. Embed each one as a `data:` URI, with a command if you can run one (`curl -s <url> | base64`; the 1400 px files weigh 10 to 30 KB), never by typing base64 out. If you can't run commands, keep the `<img>` with its `width` and `height`, and tell the user the picture stays blank inside the artifact.
- Dark mode: the viewer sets `data-theme="dark"` or `"light"` on `<html>`, or nothing when it follows the system. Write the Dark mode rules twice: inside `@media (prefers-color-scheme: dark)` with `:root:not([data-theme="light"])` in front of each selector, and with `:root[data-theme="dark"]` in front of each selector.

### WordPress

- HTML: a **Custom HTML** block (or a pattern / template part). WordPress keeps this markup as it is only for users allowed to post unfiltered HTML (Administrators; Super Admins on multisite): for anyone else it strips tags such as `<svg>`, `<input>` or `<dialog>`, so add it from the theme (a pattern or template part) instead.
- CSS and JS: the downloaded files go in the theme, under `wp-content/themes/<your-theme>/kodza/` (the child theme if there is one), enqueued from its functions.php (or a code-snippets plugin):
  ```php
  add_action('wp_enqueue_scripts', function () {
    $dir = get_stylesheet_directory() . '/kodza/';
    $uri = get_stylesheet_directory_uri() . '/kodza/';
    wp_enqueue_style('kodza-skeleton-loader', $uri . 'kodza-skeleton-loader.css', [], filemtime($dir . 'kodza-skeleton-loader.css'));
    wp_enqueue_script('kodza-skeleton-loader', $uri . 'kodza-skeleton-loader.js', [], filemtime($dir . 'kodza-skeleton-loader.js'), true);
  });
  ```
  Scoped to `kodza-` classes, the CSS never touches the theme. One copy of the JS, whatever the number of blocks.
- No access to the theme files? The CSS can also go, as it is, in **Appearance → Customize → Additional CSS** (classic theme) or **Styles → Additional CSS** in the Site Editor (block theme).
- Theme with AJAX page transitions: fire `kodza:init` on the new content after each swap (and `kodza:destroy` on the old one).
- Performance plugin (WP Rocket, LiteSpeed Cache, Perfmatters…) with **Delay JavaScript execution** turned on: add `kodza` to the scripts it must not delay. Otherwise the component waits for the visitor's first scroll, tap or mouse move, and that first click can be lost.
- Colours: by default, match the theme's palette. After the component's CSS, point these variables at the theme's colours, on the component root, Kodza's value as the fallback:
  `.kodza-skeleton { --kz-skel-fg: var(TEXT, #0a0a0a); --kz-skel-bg: var(BACKGROUND, #ffffff); }`
  TEXT, BACKGROUND and ACCENT (the colour the theme fills its own buttons with) are the theme's own colour variables — block themes (theme.json, like Twenty Twenty-Five): `--wp--preset--color--contrast`, `--wp--preset--color--base`, `--wp--preset--color--contrast` (they fill their buttons with it; their accent-1… colours are decorative); Astra: `--ast-global-color-2`, `--ast-global-color-4`, `--ast-global-color-0`; Kadence: `--global-palette3`, `--global-palette9`, `--global-palette1`; GeneratePress: `--contrast`, `--base-3`, `--accent`; Blocksy: `--theme-palette-color-4`, `--theme-palette-color-8`, `--theme-palette-color-1`. Use only these names, and only if the site really has them (the theme's CSS, or Styles → Colors): the `--wp--preset--color--black`, `--white`, `--vivid-…` that WordPress adds everywhere are not the theme's palette. Another theme, or one without these variables (Hello Elementor, OceanWP): leave the variables alone, it keeps Kodza's monochrome; same when the developer asks for monochrome or the Kodza look. Leave the translucent greys (`rgba(10, 10, 10, …)`) as they are: they suit any light background. On a dark palette, set the other variables from Dark mode too.
- WordPress turns straight quotes and `--` into typographic ones in the text of a Custom HTML block (not inside `<code>` or `<pre>`).

#### With Elementor

- HTML: an **HTML** widget (Elementor shows it to administrators only). It keeps the code exactly as pasted, straight quotes included.
- CSS and JS: as above. Elementor's Site Settings → Theme Style styles every button, field, link and image of the page, components included; the theme guard at the end of the CSS keeps the component's buttons, fields and link colours as they are.
- The Elementor editor redraws each widget after the page has loaded: without the script below, the component stays still in the editor preview (the published page works). Add it once per site, in the footer like the component's script (`kodza/elementor-editor.js`, or a code-snippets plugin):

```js
// Kodza in the Elementor editor: the editor redraws each HTML widget after the page has loaded.
// Start Kodza in what it draws, stop it in what it replaces or removes. Once per site.
window.addEventListener('elementor/frontend/init', () => {
  if (!elementorFrontend.isEditMode()) return;
  class KodzaWidget extends elementorModules.frontend.handlers.Base {
    onInit() {
      super.onInit();
      this.kodza = [...this.$element[0].children];
      document.dispatchEvent(new CustomEvent('kodza:init', { detail: { root: this.$element[0] } }));
    }
    onDestroy() {
      super.onDestroy();
      this.kodza.forEach((root) => document.dispatchEvent(new CustomEvent('kodza:destroy', { detail: { root } })));
    }
  }
  elementorFrontend.elementsHandler.attachHandler('html', KodzaWidget);
});
```

- No child theme: everything can go in the HTML widget instead, `<style>` with the CSS, the HTML, then `<script>` with the JS. It works on the page and in the editor without the script above.

### Shopify

- Files: `assets/kodza-skeleton-loader.css` and `assets/kodza-skeleton-loader.js` (the Files commands with `-o assets/…`).
- In the section: `{{ 'kodza-skeleton-loader.css' | asset_url | stylesheet_tag }}` and `<script src="{{ 'kodza-skeleton-loader.js' | asset_url }}" defer></script>`, then the HTML.
- The theme editor re-renders sections: restart them with
  `document.addEventListener('shopify:section:load', (e) => document.dispatchEvent(new CustomEvent('kodza:init', { detail: { root: e.target } })));`
  and the same with `shopify:section:unload` → `kodza:destroy`.

### React / Next.js

- Files, side by side (e.g. in `components/kodza/`): `Skeleton.tsx` (below), the CSS block under Code saved as `skeleton-loader.css` and the JS block as `skeleton-loader.js`, both as they are. The HTML block is already inside the component: skip it.
- Use it: `import { Skeleton } from '@/components/kodza/Skeleton';` then `<Skeleton />`. Props: `variant` ("card", "list", or several in an array), `loading` (`data-loading`), `vars` (the `--kz-…` variables listed under API, e.g. `vars={{ '--kz-skel-bg': … }}`), `className`, `style` and the other props of its `<article>` (`onClick`, `aria-…`).
- Next.js App Router: it is a Client Component already (`'use client'`). Pages Router: Next.js takes global CSS only in `pages/_app`, so move the `import './skeleton-loader.css'` line there.
- Safe under StrictMode, client-side navigation and prop changes: when a prop changes, the `key` gives React a fresh element, `kodza:destroy` stops the script on the old one and `kodza:init` starts it on the new one.

```tsx
'use client';
// Kodza — Skeleton, for React. From https://kodza.dev/components/skeleton-loader/
// Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license
// Next to this file: skeleton-loader.css and skeleton-loader.js, the component's CSS and JS from Kodza, as they are.
// Yours to edit: the markup is plain JSX below.
// The script changes this markup once React has rendered it (it adds layers, splits text, moves
// nodes), so React must not patch it afterwards. When a prop changes, the key gives React a fresh
// element: kodza:destroy stops the script on the old one, kodza:init starts it on the new one.
import { useRef, useEffect, type ComponentPropsWithoutRef, type ComponentRef, type CSSProperties } from 'react';
import './skeleton-loader.css';

type Variant = "card" | "list";

export type SkeletonProps = Omit<ComponentPropsWithoutRef<'article'>, "children" | "variant" | "vars" | "loading"> & {
  /** Modifier class(es): .kodza-skeleton--card, .kodza-skeleton--list */
  variant?: Variant | Variant[];
  /** data-loading on the root */
  loading?: string;
  /** Settings, as CSS variables on the root */
  vars?: {
    /** default: #ffffff */
    "--kz-skel-bg"?: string | number;
    /** default: #0a0a0a */
    "--kz-skel-fg"?: string | number;
    /** default: rgba(10, 10, 10, 0.62) */
    "--kz-skel-muted"?: string | number;
    /** default: rgba(10, 10, 10, 0.1) */
    "--kz-skel-border"?: string | number;
    /** default: #ededeb */
    "--kz-skel-bone"?: string | number;
    /** default: rgba(255, 255, 255, 0.85) */
    "--kz-skel-shine"?: string | number;
    /** default: 1.6s */
    "--kz-skel-speed"?: string | number;
    /** default: 16px */
    "--kz-skel-radius"?: string | number;
    /** default: 28px */
    "--kz-skel-pad"?: string | number;
  };
  className?: string;
};

export function Skeleton({ variant, loading, vars, className, style, ...rest }: SkeletonProps) {
  const ref = useRef<ComponentRef<'article'>>(null);
  const classes = ["kodza-skeleton", "kodza-skeleton--card", ...([] as string[]).concat(variant ?? []).map((v) => `kodza-skeleton--${v}`), className].filter(Boolean).join(' ');
  // Everything the markup is made of: when it changes, React gets a fresh element (see the top)
  const key = JSON.stringify([classes, loading, vars, style, rest]);

  // Starts the script on this element once React has rendered it, stops it when it goes
  useEffect(() => {
    const root = ref.current;
    let live = true;
    // @ts-ignore: a plain script, no types to find
    import('./skeleton-loader.js').then(() => {
      if (live) document.dispatchEvent(new CustomEvent('kodza:init', { detail: { root } }));
    });
    return () => {
      live = false;
      document.dispatchEvent(new CustomEvent('kodza:destroy', { detail: { root } }));
    };
  }, [key]);

  return (
    <article key={key} {...rest} className={classes} data-loading={loading} style={{ ...vars, ...style } as CSSProperties} ref={ref}>
      <div className="kodza-skeleton__media" data-bone="block">
        <img src="https://kodza.dev/media/kz-steps-1400.webp" alt="Concrete steps climbing towards a bright opening" width="1400" height="933" />
      </div>
      <div className="kodza-skeleton__body">
        <p className="kodza-skeleton__meta" data-bone="">Changelog · 3 min read</p>
        <h3 className="kodza-skeleton__title" data-bone="">Version 2.0 deletes more code than it adds</h3>
        <p className="kodza-skeleton__text" data-bone="">Four thousand lines gone, zero features lost, one very confused linter.</p>
        <p className="kodza-skeleton__by">
          <span className="kodza-skeleton__avatar" data-bone="block">KZ</span>
          {' '}
          <span data-bone="">The Kodza team</span>
        </p>
      </div>
    </article>
  );
}
```

## Code

```html
<article class="kodza-skeleton kodza-skeleton--card" data-loading>
  <div class="kodza-skeleton__media" data-bone="block">
    <img src="https://kodza.dev/media/kz-steps-1400.webp" alt="Concrete steps climbing towards a bright opening" width="1400" height="933" />
  </div>
  <div class="kodza-skeleton__body">
    <p class="kodza-skeleton__meta" data-bone>Changelog · 3 min read</p>
    <h3 class="kodza-skeleton__title" data-bone>Version 2.0 deletes more code than it adds</h3>
    <p class="kodza-skeleton__text" data-bone>Four thousand lines gone, zero features lost, one very confused linter.</p>
    <p class="kodza-skeleton__by">
      <span class="kodza-skeleton__avatar" data-bone="block">KZ</span>
      <span data-bone>The Kodza team</span>
    </p>
  </div>
</article>

<ul class="kodza-skeleton kodza-skeleton--list" data-loading>
  <li class="kodza-skeleton__row">
    <span class="kodza-skeleton__avatar" data-bone="block">AL</span>
    <span class="kodza-skeleton__lines"><strong data-bone>Ada merged #482</strong><span data-bone>Fixed the bug she wrote on Monday</span></span>
    <span class="kodza-skeleton__time" data-bone>2m</span>
  </li>
  <li class="kodza-skeleton__row">
    <span class="kodza-skeleton__avatar" data-bone="block">LT</span>
    <span class="kodza-skeleton__lines"><strong data-bone>Linus opened #483</strong><span data-bone>Tabs or spaces, round 2,048</span></span>
    <span class="kodza-skeleton__time" data-bone>14m</span>
  </li>
  <li class="kodza-skeleton__row">
    <span class="kodza-skeleton__avatar" data-bone="block">GH</span>
    <span class="kodza-skeleton__lines"><strong data-bone>Grace deployed v2.0</strong><span data-bone>Production is fine. Probably.</span></span>
    <span class="kodza-skeleton__time" data-bone>1h</span>
  </li>
</ul>
```

```css
/* Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license */
/* Kodza — Skeleton
   The bones are taken from the content itself: each line of text becomes a bar of its real
   length, each image or avatar a block of its real shape, so nothing moves when it loads. One
   shine runs across all the bones at once. Remove data-loading and the bones open in reading
   order: each bar pulls away to the right and uncovers its line, the image settles from a
   slight zoom, the avatar pops; an image that has not arrived yet keeps its bone until it
   has. Mark the parts with data-bone (text) or data-bone="block" (image, avatar, any
   box); keep placeholder words in them while loading, they give the bones their shape.
   Ready-made layouts: --card and --list. Everything is tuned with the --kz-skel-* variables. */
.kodza-skeleton {
  --kz-skel-bg: #ffffff;
  --kz-skel-fg: #0a0a0a;
  --kz-skel-muted: rgba(10, 10, 10, 0.62);
  --kz-skel-border: rgba(10, 10, 10, 0.1);
  --kz-skel-bone: #ededeb;
  --kz-skel-shine: rgba(255, 255, 255, 0.85);
  --kz-skel-speed: 1.6s;
  --kz-skel-radius: 16px;
  --kz-skel-pad: 28px;

  position: relative;
  box-sizing: border-box;
  color: var(--kz-skel-fg);
}

/* The parts hide while loading (the bones are drawn over them) */
.kodza-skeleton[data-loading] [data-bone],
.kodza-skeleton [data-bone].is-waiting {
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* The bones: one layer over the content, bars placed by the script */
.kodza-skeleton__bones {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.kodza-skeleton__bone {
  position: absolute;
  border-radius: 6px;
  background-color: var(--kz-skel-bone);
  background-image: linear-gradient(90deg, transparent, var(--kz-skel-shine), transparent);
  background-repeat: no-repeat;
  background-size: var(--kz-skel-band, 240px) 100%;
  background-position: calc(var(--kz-skel-band, 240px) * -1 - var(--kz-skel-x, 0px)) 0;
  animation: kodza-skeleton-shine var(--kz-skel-speed) cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

/* A line of text: a bar a little thinner than the words */
.kodza-skeleton__bone.is-line {
  transform: scaleY(0.62);
}

/* Every bone uses the same clock and the card's coordinates: one shine crosses them all */
@keyframes kodza-skeleton-shine {
  0% {
    background-position: calc(var(--kz-skel-band, 240px) * -1 - var(--kz-skel-x, 0px)) 0;
  }
  70%,
  100% {
    background-position: calc(var(--kz-skel-w, 600px) - var(--kz-skel-x, 0px)) 0;
  }
}

/* Card */
.kodza-skeleton--card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--kz-skel-radius);
  background: var(--kz-skel-bg);
  box-shadow: inset 0 0 0 1px var(--kz-skel-border);
}

.kodza-skeleton__media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.kodza-skeleton__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.kodza-skeleton__body {
  display: grid;
  gap: 10px;
  padding: var(--kz-skel-pad);
}

.kodza-skeleton__meta {
  margin: 0;
  justify-self: start;
  color: var(--kz-skel-muted);
  font-size: 13px;
}

.kodza-skeleton__title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.kodza-skeleton__text {
  margin: 0;
  color: var(--kz-skel-muted);
  font-size: 15px;
  line-height: 1.55;
  text-wrap: pretty;
}

.kodza-skeleton__by {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 500;
}

.kodza-skeleton__avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--kz-skel-fg);
  color: var(--kz-skel-bg);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* List */
.kodza-skeleton--list {
  margin: 0;
  padding: 8px var(--kz-skel-pad);
  border-radius: var(--kz-skel-radius);
  background: var(--kz-skel-bg);
  box-shadow: inset 0 0 0 1px var(--kz-skel-border);
  list-style: none;
}

.kodza-skeleton__row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
}

.kodza-skeleton__row + .kodza-skeleton__row {
  border-top: 1px solid var(--kz-skel-border);
}

.kodza-skeleton__row .kodza-skeleton__avatar {
  width: 40px;
  height: 40px;
  font-size: 13px;
}

.kodza-skeleton__lines {
  display: grid;
  flex: 1;
  justify-items: start;
  gap: 2px;
  min-width: 0;
  font-size: 15px;
  line-height: 1.45;
}

.kodza-skeleton__lines strong {
  font-weight: 600;
}

.kodza-skeleton__lines span {
  color: var(--kz-skel-muted);
  font-size: 14px;
}

.kodza-skeleton__time {
  align-self: flex-start;
  margin-top: 2px;
  color: var(--kz-skel-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  .kodza-skeleton__bone {
    animation: none;
  }

  .kodza-skeleton[data-loading] [data-bone] {
    transition: none;
  }
}

/* Theming example — on a dark background:
.dark-section .kodza-skeleton {
  --kz-skel-bg: #161616;
  --kz-skel-fg: #f2f2f0;
  --kz-skel-muted: rgba(242, 242, 240, 0.62);
  --kz-skel-border: rgba(255, 255, 255, 0.12);
  --kz-skel-bone: #232323;
  --kz-skel-shine: rgba(255, 255, 255, 0.07);
}
*/

/* kodza-guard 958420f1ca00 — generated by Kodza, do not edit.
   Theme guard: keeps a site's own CSS (WordPress themes, Bootstrap, CSS resets…) off this
   component. :not(#_) is always true and weighs as much as an id, so these lines win over
   theme rules made of classes and tags. Customise the component through its --kz-* variables. */

/* What the browser gives, where the component sets it only in some states: at the lowest weight, so its own rules below put it back */

:where(.kodza-skeleton):not(#_) {
  padding: revert;
  list-style: revert;
}

:where(.kodza-skeleton__meta):not(#_),
:where(.kodza-skeleton__title):not(#_),
:where(.kodza-skeleton__text):not(#_),
:where(.kodza-skeleton__by):not(#_),
:where(.kodza-skeleton__media img:where(:not([class*="kodza-"]))):not(#_),
:where(.kodza-skeleton__lines strong:where(:not([class*="kodza-"]))):not(#_) {
  transition: revert;
}

:where(.kodza-skeleton__row):not(#_) {
  transition: revert;
  border-top-width: revert;
  border-top-style: revert;
  border-top-color: revert;
}

:where(.kodza-skeleton):not(#_):where(:not([hidden])) {
  display: revert;
}

:where(.kodza-skeleton):not(#_):where([hidden]) {
  display: none;
}

/* What the browser gives, on everything the component leaves to it */

.kodza-skeleton:not(#_) {
  border: revert;
  outline: revert;
  text-decoration: revert;
  transition: revert;
  outline-offset: revert;
  appearance: revert;
  max-height: revert;
  font-family: revert;
  font-size: revert;
  font-weight: revert;
  font-style: revert;
  line-height: revert;
  letter-spacing: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
}

.kodza-skeleton__media:not(#_),
.kodza-skeleton__body:not(#_),
.kodza-skeleton__avatar:not(#_),
.kodza-skeleton__bones:not(#_),
.kodza-skeleton__bone:not(#_),
.kodza-skeleton__lines:not(#_),
.kodza-skeleton__time:not(#_),
.kodza-skeleton__by span:where(:not([class*="kodza-"])):not(#_),
.kodza-skeleton__lines span:where(:not([class*="kodza-"])):not(#_) {
  box-sizing: revert;
}

.kodza-skeleton__meta:not(#_) {
  border: revert;
  padding: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  position: revert;
  background-color: revert;
  background-image: revert;
  box-shadow: revert;
  outline-offset: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  font-family: revert;
  font-weight: revert;
  font-style: revert;
  line-height: revert;
  letter-spacing: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
}

.kodza-skeleton__title:not(#_) {
  border: revert;
  padding: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  position: revert;
  background-color: revert;
  background-image: revert;
  box-shadow: revert;
  outline-offset: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  color: revert;
  font-family: revert;
  font-style: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
}

.kodza-skeleton__text:not(#_) {
  border: revert;
  padding: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  position: revert;
  background-color: revert;
  background-image: revert;
  box-shadow: revert;
  outline-offset: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  font-family: revert;
  font-weight: revert;
  font-style: revert;
  letter-spacing: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
}

.kodza-skeleton__by:not(#_) {
  border: revert;
  padding: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  position: revert;
  background-color: revert;
  background-image: revert;
  box-shadow: revert;
  outline-offset: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  color: revert;
  font-family: revert;
  font-style: revert;
  line-height: revert;
  letter-spacing: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
}

.kodza-skeleton__row:not(#_) {
  margin: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  position: revert;
  border-right-width: revert;
  border-bottom-width: revert;
  border-left-width: revert;
  border-right-style: revert;
  border-bottom-style: revert;
  border-left-style: revert;
  border-right-color: revert;
  border-bottom-color: revert;
  border-left-color: revert;
  background-color: revert;
  background-image: revert;
  box-shadow: revert;
  outline-offset: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  color: revert;
  font-family: revert;
  font-size: revert;
  font-weight: revert;
  font-style: revert;
  line-height: revert;
  letter-spacing: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
}

.kodza-skeleton__media img:where(:not([class*="kodza-"])):not(#_) {
  border: revert;
  margin: revert;
  padding: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  position: revert;
  background-color: revert;
  background-image: revert;
  box-shadow: revert;
  outline-offset: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  color: revert;
  font-family: revert;
  font-size: revert;
  font-weight: revert;
  font-style: revert;
  line-height: revert;
  letter-spacing: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
}

.kodza-skeleton__lines strong:where(:not([class*="kodza-"])):not(#_) {
  border: revert;
  margin: revert;
  padding: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  position: revert;
  background-color: revert;
  background-image: revert;
  box-shadow: revert;
  outline-offset: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  color: revert;
  font-family: revert;
  font-size: revert;
  font-style: revert;
  line-height: revert;
  letter-spacing: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
}

.kodza-skeleton__meta:not(#_):where(:not([hidden])),
.kodza-skeleton__title:not(#_):where(:not([hidden])),
.kodza-skeleton__text:not(#_):where(:not([hidden])),
.kodza-skeleton__lines strong:where(:not([class*="kodza-"])):not(#_):where(:not([hidden])) {
  display: revert;
}

.kodza-skeleton__meta:not(#_):where([hidden]),
.kodza-skeleton__title:not(#_):where([hidden]),
.kodza-skeleton__text:not(#_):where([hidden]),
.kodza-skeleton__lines strong:where(:not([class*="kodza-"])):not(#_):where([hidden]) {
  display: none;
}

/* The component's own rules, one step stronger: real buttons and fields, what it sets on tags themes style (links, lists, headings, images…), and the root width (a theme may narrow it, never widen it) */

.kodza-skeleton:not(#_) {
  position: relative;
  box-sizing: border-box;
  color: var(--kz-skel-fg);
}

.kodza-skeleton[data-loading] [data-bone]:where(img, p, h3, li, strong):not(#_),
.kodza-skeleton [data-bone].is-waiting:where(img, p, h3, li, strong):not(#_) {
  transition: opacity 0.2s ease;
}

.kodza-skeleton--card:not(#_) {
  display: flex;
  border-radius: var(--kz-skel-radius);
  background: var(--kz-skel-bg);
  box-shadow: inset 0 0 0 1px var(--kz-skel-border);
}

.kodza-skeleton__media img:not(#_) {
  display: block;
}

.kodza-skeleton__meta:not(#_) {
  margin: 0;
  color: var(--kz-skel-muted);
  font-size: 13px;
}

.kodza-skeleton__title:not(#_) {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.kodza-skeleton__text:not(#_) {
  margin: 0;
  color: var(--kz-skel-muted);
  font-size: 15px;
  line-height: 1.55;
}

.kodza-skeleton__by:not(#_) {
  display: flex;
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 500;
}

.kodza-skeleton--list:not(#_) {
  padding: 8px var(--kz-skel-pad);
  border-radius: var(--kz-skel-radius);
  background: var(--kz-skel-bg);
  box-shadow: inset 0 0 0 1px var(--kz-skel-border);
  list-style: none;
}

.kodza-skeleton__row:not(#_) {
  display: flex;
  padding: 16px 0;
}

.kodza-skeleton__row + .kodza-skeleton__row:not(#_) {
  border-top: 1px solid var(--kz-skel-border);
}

.kodza-skeleton__lines strong:not(#_) {
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .kodza-skeleton[data-loading] [data-bone]:where(img, p, h3, li, strong):not(#_) {
    transition: none;
  }
}
```

```js
// Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license
// Kodza — Skeleton
// Draws the bones from the content (one bar per line of text, one block per data-bone="block"),
// in the skeleton's own pixels so a scaled parent does not shift them, and redraws them when the
// size changes. When data-loading goes, the bones open in reading order: each bar swells to the
// height of its line and pulls away to the right, uncovering the words; a block lifts off its
// image, which settles from a slight zoom; an avatar pops. An image still on its way keeps its
// bone until it has loaded. Set data-loading again to go back to the bones.
(() => {
  const SELECTOR = '.kodza-skeleton';
  const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
  const STEP = 70; // between two bones, in reading order
  const SWELL = 220; // a bar swells to the height of its line
  const PULL = 420; // then pulls away to the right
  const inOut = 'cubic-bezier(0.76, 0, 0.24, 1)';
  const out = 'cubic-bezier(0.22, 1, 0.36, 1)';

  // One instance. Everything it starts is tied to `signal`, so kodza:destroy stops it all
  function mount(root, signal) {
    const parts = [...root.querySelectorAll('[data-bone]')];
    if (!parts.length) return;
    const layer = Object.assign(document.createElement('span'), { className: 'kodza-skeleton__bones' });
    layer.setAttribute('aria-hidden', 'true');
    root.append(layer);
    const bones = new Map(); // part → its bars

    const unloaded = (part) => [...(part.matches('img') ? [part] : part.querySelectorAll('img'))].some((img) => !img.complete || !img.naturalWidth);

    // One bar per line of text (a little thinner than the line), or the part's own box
    const draw = () => {
      layer.replaceChildren();
      bones.clear();
      const box = root.getBoundingClientRect();
      const k = box.width / root.offsetWidth || 1;
      root.style.setProperty('--kz-skel-w', `${root.offsetWidth}px`);
      root.style.setProperty('--kz-skel-band', `${Math.round(root.offsetWidth * 0.45)}px`);
      parts.forEach((part) => {
        if (!root.hasAttribute('data-loading') && !part.classList.contains('is-waiting')) return;
        const block = part.dataset.bone === 'block' || !part.textContent.trim();
        let rects;
        if (block) rects = [part.getBoundingClientRect()];
        else {
          const range = document.createRange();
          range.selectNodeContents(part);
          rects = [...range.getClientRects()].filter((r) => r.width > 1);
        }
        const radius = block ? getComputedStyle(part).borderRadius : '';
        const bars = rects.map((r) => {
          const x = (r.left - box.left) / k;
          const w = r.width / k;
          const full = r.height / k;
          const h = full;
          const y = (r.top - box.top) / k;
          const bar = Object.assign(document.createElement('span'), { className: 'kodza-skeleton__bone' });
          Object.assign(bar.style, { left: `${x}px`, top: `${y}px`, width: `${w}px`, height: `${h}px` });
          if (block) bar.style.borderRadius = radius;
          else bar.classList.add('is-line');
          bar.style.setProperty('--kz-skel-x', `${x}px`);
          layer.append(bar);
          return { bar, y, h };
        });
        bones.set(part, bars);
      });
    };

    const reveal = (list) => {
      const box = root.getBoundingClientRect();
      const k = box.width / root.offsetWidth || 1;
      const top = (el) => el.getBoundingClientRect().top;
      let order = 0;
      [...list].sort((a, b) => top(a) - top(b)).forEach((part) => {
        part.classList.remove('is-waiting');
        const bars = bones.get(part) || [];
        bones.delete(part);
        if (reduceMotion) return bars.forEach(({ bar }) => bar.remove());
        const block = part.dataset.bone === 'block' || !part.textContent.trim();
        if (block) {
          const delay = order++ * STEP;
          const img = part.matches('img') ? part : part.querySelector('img');
          // The bone lifts off, quick at first so the image never shows as a thin line under
          // it; the image settles from a slight zoom, an avatar pops
          bars.forEach(({ bar }) => {
            bar.style.transformOrigin = img ? '50% 0' : '50% 50%';
            bar.animate([{ transform: 'none' }, { transform: img ? 'scaleY(0)' : 'scale(0)' }], { duration: img ? 650 : 420, delay, easing: img ? out : inOut, fill: 'forwards' }).onfinish = () => bar.remove();
          });
          if (img) img.animate([{ transform: 'scale(1.14)' }, { transform: 'none' }], { duration: 1300, delay, easing: out, fill: 'backwards' });
          else part.animate([{ transform: 'scale(0.4)', opacity: 0 }, { transform: 'scale(1.08)', opacity: 1, offset: 0.6 }, { transform: 'none', opacity: 1 }], { duration: 520, delay: delay + 140, easing: out, fill: 'backwards' });
          return;
        }
        // Each line: the bars of a part swell together to the height of the words, which show
        // only once every bar covers its line (no ascender or descender peeks out); then each
        // bar pulls away to the right, one line after the other
        const delay = order * STEP;
        order += bars.length;
        bars.forEach(({ bar }, i) => {
          const hold = SWELL + i * STEP;
          const duration = hold + PULL;
          bar.style.transformOrigin = '100% 50%';
          bar.animate([
            { transform: 'scale(1, 0.62)', easing: out },
            { transform: 'scale(1, 1)', offset: SWELL / duration },
            { transform: 'scale(1, 1)', offset: hold / duration, easing: inOut },
            { transform: 'scale(0, 1)' },
          ], { duration, delay, fill: 'forwards' }).onfinish = () => bar.remove();
        });
        if (bars.length) part.animate({ opacity: [0, 0] }, { duration: delay + SWELL });
      });
    };

    const finish = () => {
      root.removeAttribute('aria-busy');
      // Images still on their way keep their bones, and come in on their own
      const late = parts.filter(unloaded);
      late.forEach((part) => {
        part.classList.add('is-waiting');
        part.querySelectorAll('img').forEach((img) => img.addEventListener('load', () => {
          if (!root.hasAttribute('data-loading') && part.classList.contains('is-waiting') && !unloaded(part)) reveal([part]);
        }, { once: true, signal }));
      });
      reveal(parts.filter((part) => !late.includes(part)));
    };

    const start = () => {
      root.setAttribute('aria-busy', 'true');
      // Stop a reveal still playing, but not the fade of the content under the bones
      parts.forEach((part) => {
        part.getAnimations({ subtree: true }).forEach((animation) => animation instanceof CSSTransition || animation.cancel());
      });
      draw();
      if (!reduceMotion) layer.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 220, easing: 'ease' });
    };

    if (root.hasAttribute('data-loading')) start();
    const mutations = new MutationObserver(() => (root.hasAttribute('data-loading') ? start() : finish()));
    mutations.observe(root, { attributes: true, attributeFilter: ['data-loading'] });
    const resize = new ResizeObserver(() => (root.hasAttribute('data-loading') || parts.some((part) => part.classList.contains('is-waiting'))) && draw());
    resize.observe(root);
    signal.addEventListener('abort', () => {
      mutations.disconnect();
      resize.disconnect();
    });
    document.fonts?.ready.then(() => !signal.aborted && root.hasAttribute('data-loading') && draw());
  }

  // Kodza lifecycle, the same in every component: `kodza:init` starts the instances inside
  // event.detail.root (the whole page by default), `kodza:destroy` stops them and puts their
  // markup back. For themes and apps that swap content without a page load.
  const instances = new WeakMap();
  const find = (scope = document) => [scope, ...scope.querySelectorAll(SELECTOR)].filter((el) => el.matches?.(SELECTOR));
  const init = (scope) => find(scope).forEach((root) => {
    if (root.classList.contains('is-ready')) return; // already running, maybe from another copy of this script
    const controller = new AbortController();
    instances.set(root, { controller, html: root.innerHTML, attrs: [...root.attributes].map((a) => [a.name, a.value]) });
    mount(root, controller.signal);
    root.classList.add('is-ready');
  });
  const destroy = (scope) => find(scope).forEach((root) => {
    const instance = instances.get(root);
    if (!instance) return;
    instances.delete(root);
    instance.controller.abort();
    [...root.attributes].forEach((a) => root.removeAttribute(a.name));
    instance.attrs.forEach(([name, value]) => root.setAttribute(name, value));
    root.innerHTML = instance.html;
  });
  document.addEventListener('kodza:init', (event) => init(event.detail?.root));
  document.addEventListener('kodza:destroy', (event) => destroy(event.detail?.root));
  init();
  // Loaded in <head>, the script runs before the markup exists: once more when it is parsed
  if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', () => init(), { once: true });
})();
```

Free to use, from Kodza (https://kodza.dev).
