# Stepper

> A flow in four steps: the line fills, a check draws itself on each finished step and the content slides in from where you are heading.

Navigation · steps, wizard, progress, nav · HTML, CSS, vanilla JS · no dependencies · updated 2026-10-16
Demo: https://kodza.dev/components/stepper/

## Files

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

- [`kodza-stepper.css`](https://kodza.dev/registry/stepper/kodza-stepper.css) · 16.3 KB
- [`kodza-stepper.js`](https://kodza.dev/registry/stepper/kodza-stepper.js) · 6.6 KB
- [`kodza-stepper.html`](https://kodza.dev/registry/stepper/kodza-stepper.html) · 2.7 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-stepper.css https://kodza.dev/registry/stepper/kodza-stepper.css
curl -fsSL --create-dirs -o kodza/kodza-stepper.js https://kodza.dev/registry/stepper/kodza-stepper.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-stepper`
- Variables (set them on the root element itself: it declares its own defaults):
  - `--kz-stepper-bg: #ffffff`
  - `--kz-stepper-fg: #0a0a0a`
  - `--kz-stepper-muted: rgba(10, 10, 10, 0.6)`
  - `--kz-stepper-border: rgba(10, 10, 10, 0.1)`
  - `--kz-stepper-line: rgba(10, 10, 10, 0.12)`
  - `--kz-stepper-ink: #0a0a0a`
  - `--kz-stepper-on-ink: #ffffff`
  - `--kz-stepper-dot: 28px`
  - `--kz-stepper-duration: 0.6s`
  - `--kz-stepper-ease: cubic-bezier(0.22, 1, 0.36, 1)`
- Attributes:
  - `data-again` (e.g. `Start over`)
  - `data-last` (e.g. `Ship it`)
- Events: `kodza:step` (bubbling, from the root)
- 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-stepper {
    --kz-stepper-bg: #161616;
    --kz-stepper-fg: #f2f2f0;
    --kz-stepper-muted: rgba(242, 242, 240, 0.58);
    --kz-stepper-border: rgba(255, 255, 255, 0.12);
    --kz-stepper-line: rgba(255, 255, 255, 0.16);
    --kz-stepper-ink: #f2f2f0;
    --kz-stepper-on-ink: #161616;
  }
}
```

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

## Use it

### Plain HTML page

- CSS: `kodza/kodza-stepper.css` next to the page (the Files commands as they are), linked in `<head>`: `<link rel="stylesheet" href="kodza/kodza-stepper.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-stepper.js`, loaded with `<script src="kodza/kodza-stepper.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-stepper.css' -e 'd' -e '}' -e '/^KODZA-JS$/{r kodza/kodza-stepper.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">`.
- 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-stepper', $uri . 'kodza-stepper.css', [], filemtime($dir . 'kodza-stepper.css'));
    wp_enqueue_script('kodza-stepper', $uri . 'kodza-stepper.js', [], filemtime($dir . 'kodza-stepper.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-stepper { --kz-stepper-fg: var(TEXT, #0a0a0a); --kz-stepper-bg: var(BACKGROUND, #ffffff); --kz-stepper-ink: var(ACCENT, #0a0a0a); --kz-stepper-on-ink: 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-stepper.css` and `assets/kodza-stepper.js` (the Files commands with `-o assets/…`).
- In the section: `{{ 'kodza-stepper.css' | asset_url | stylesheet_tag }}` and `<script src="{{ 'kodza-stepper.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/`): `Stepper.tsx` (below), the CSS block under Code saved as `stepper.css` and the JS block as `stepper.js`, both as they are. The HTML block is already inside the component: skip it.
- Use it: `import { Stepper } from '@/components/kodza/Stepper';` then `<Stepper />`. Props: `vars` (the `--kz-…` variables listed under API, e.g. `vars={{ '--kz-stepper-bg': … }}`), `onStep` (the `kodza:step` event), `className`, `style` and the other props of its `<div>` (`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 './stepper.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 — Stepper, for React. From https://kodza.dev/components/stepper/
// 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: stepper.css and stepper.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 './stepper.css';

export type StepperProps = Omit<ComponentPropsWithoutRef<'div'>, "children" | "vars" | "onStep"> & {
  /** Settings, as CSS variables on the root */
  vars?: {
    /** default: #ffffff */
    "--kz-stepper-bg"?: string | number;
    /** default: #0a0a0a */
    "--kz-stepper-fg"?: string | number;
    /** default: rgba(10, 10, 10, 0.6) */
    "--kz-stepper-muted"?: string | number;
    /** default: rgba(10, 10, 10, 0.1) */
    "--kz-stepper-border"?: string | number;
    /** default: rgba(10, 10, 10, 0.12) */
    "--kz-stepper-line"?: string | number;
    /** default: #0a0a0a */
    "--kz-stepper-ink"?: string | number;
    /** default: #ffffff */
    "--kz-stepper-on-ink"?: string | number;
    /** default: 28px */
    "--kz-stepper-dot"?: string | number;
    /** default: 0.6s */
    "--kz-stepper-duration"?: string | number;
    /** default: cubic-bezier(0.22, 1, 0.36, 1) */
    "--kz-stepper-ease"?: string | number;
  };
  /** "kodza:step", fired by the script (bubbles from the root) */
  onStep?: (event: CustomEvent) => void;
  className?: string;
};

export function Stepper({ vars, onStep, className, style, ...rest }: StepperProps) {
  const ref = useRef<ComponentRef<'div'>>(null);
  const classes = ["kodza-stepper", 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, 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('./stepper.js').then(() => {
      if (live) document.dispatchEvent(new CustomEvent('kodza:init', { detail: { root } }));
    });
    return () => {
      live = false;
      document.dispatchEvent(new CustomEvent('kodza:destroy', { detail: { root } }));
    };
  }, [key]);

  useEffect(() => {
    const root = ref.current;
    if (!root || !onStep) return;
    const listener = (event: Event) => onStep(event as CustomEvent);
    root.addEventListener("kodza:step", listener);
    return () => root.removeEventListener("kodza:step", listener);
  }, [onStep, key]);

  return (
    <div key={key} {...rest} className={classes} style={{ ...vars, ...style } as CSSProperties} ref={ref}>
      <ol className="kodza-stepper__steps">
        <li className="kodza-stepper__step">
          <button className="kodza-stepper__dot" type="button">
            <span className="kodza-stepper__num">1</span>
            <svg className="kodza-stepper__check" viewBox="0 0 16 16" aria-hidden="true">
              <path d="M3.5 8.5l3 3 6-7" pathLength="1" />
            </svg>
          </button>
          <span className="kodza-stepper__label">Copy</span>
        </li>
        <li className="kodza-stepper__step">
          <button className="kodza-stepper__dot" type="button">
            <span className="kodza-stepper__num">2</span>
            <svg className="kodza-stepper__check" viewBox="0 0 16 16" aria-hidden="true">
              <path d="M3.5 8.5l3 3 6-7" pathLength="1" />
            </svg>
          </button>
          <span className="kodza-stepper__label">Paste</span>
        </li>
        <li className="kodza-stepper__step">
          <button className="kodza-stepper__dot" type="button">
            <span className="kodza-stepper__num">3</span>
            <svg className="kodza-stepper__check" viewBox="0 0 16 16" aria-hidden="true">
              <path d="M3.5 8.5l3 3 6-7" pathLength="1" />
            </svg>
          </button>
          <span className="kodza-stepper__label">Tweak</span>
        </li>
        <li className="kodza-stepper__step">
          <button className="kodza-stepper__dot" type="button">
            <span className="kodza-stepper__num">4</span>
            <svg className="kodza-stepper__check" viewBox="0 0 16 16" aria-hidden="true">
              <path d="M3.5 8.5l3 3 6-7" pathLength="1" />
            </svg>
          </button>
          <span className="kodza-stepper__label">Ship</span>
        </li>
      </ol>
      <div className="kodza-stepper__panels" aria-live="polite">
        <section className="kodza-stepper__panel">
          <h3 className="kodza-stepper__title">Copy the code</h3>
          <p className="kodza-stepper__text">Three tabs: HTML, CSS, JS. Click the button, the clipboard does the rest.</p>
        </section>
        <section className="kodza-stepper__panel" hidden>
          <h3 className="kodza-stepper__title">Paste it anywhere</h3>
          <p className="kodza-stepper__text">A WordPress block, a Webflow embed, a plain page from 2009. It does not judge.</p>
        </section>
        <section className="kodza-stepper__panel" hidden>
          <h3 className="kodza-stepper__title">Tweak the variables</h3>
          <p className="kodza-stepper__text">Colors, sizes and timings live in --kz-* variables. Rebrand it in thirty seconds.</p>
        </section>
        <section className="kodza-stepper__panel" hidden>
          <h3 className="kodza-stepper__title">Ship it</h3>
          <p className="kodza-stepper__text">Push to production. Yes, even on a Friday. We believe in you, mostly.</p>
        </section>
        <section className="kodza-stepper__panel kodza-stepper__done" hidden>
          <h3 className="kodza-stepper__title">Shipped.</h3>
          <p className="kodza-stepper__text">Four steps, zero dependencies. Go home early.</p>
        </section>
      </div>
      <div className="kodza-stepper__actions">
        <button className="kodza-stepper__back" type="button">Back</button>
        {' '}
        <button className="kodza-stepper__next" type="button" data-last="Ship it" data-again="Start over">Next</button>
      </div>
    </div>
  );
}
```

## Code

```html
<div class="kodza-stepper">
  <ol class="kodza-stepper__steps">
    <li class="kodza-stepper__step"><button class="kodza-stepper__dot" type="button"><span class="kodza-stepper__num">1</span><svg class="kodza-stepper__check" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 8.5l3 3 6-7" pathLength="1"/></svg></button><span class="kodza-stepper__label">Copy</span></li>
    <li class="kodza-stepper__step"><button class="kodza-stepper__dot" type="button"><span class="kodza-stepper__num">2</span><svg class="kodza-stepper__check" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 8.5l3 3 6-7" pathLength="1"/></svg></button><span class="kodza-stepper__label">Paste</span></li>
    <li class="kodza-stepper__step"><button class="kodza-stepper__dot" type="button"><span class="kodza-stepper__num">3</span><svg class="kodza-stepper__check" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 8.5l3 3 6-7" pathLength="1"/></svg></button><span class="kodza-stepper__label">Tweak</span></li>
    <li class="kodza-stepper__step"><button class="kodza-stepper__dot" type="button"><span class="kodza-stepper__num">4</span><svg class="kodza-stepper__check" viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 8.5l3 3 6-7" pathLength="1"/></svg></button><span class="kodza-stepper__label">Ship</span></li>
  </ol>
  <div class="kodza-stepper__panels" aria-live="polite">
    <section class="kodza-stepper__panel">
      <h3 class="kodza-stepper__title">Copy the code</h3>
      <p class="kodza-stepper__text">Three tabs: HTML, CSS, JS. Click the button, the clipboard does the rest.</p>
    </section>
    <section class="kodza-stepper__panel" hidden>
      <h3 class="kodza-stepper__title">Paste it anywhere</h3>
      <p class="kodza-stepper__text">A WordPress block, a Webflow embed, a plain page from 2009. It does not judge.</p>
    </section>
    <section class="kodza-stepper__panel" hidden>
      <h3 class="kodza-stepper__title">Tweak the variables</h3>
      <p class="kodza-stepper__text">Colors, sizes and timings live in --kz-* variables. Rebrand it in thirty seconds.</p>
    </section>
    <section class="kodza-stepper__panel" hidden>
      <h3 class="kodza-stepper__title">Ship it</h3>
      <p class="kodza-stepper__text">Push to production. Yes, even on a Friday. We believe in you, mostly.</p>
    </section>
    <section class="kodza-stepper__panel kodza-stepper__done" hidden>
      <h3 class="kodza-stepper__title">Shipped.</h3>
      <p class="kodza-stepper__text">Four steps, zero dependencies. Go home early.</p>
    </section>
  </div>
  <div class="kodza-stepper__actions">
    <button class="kodza-stepper__back" type="button">Back</button>
    <button class="kodza-stepper__next" type="button" data-last="Ship it" data-again="Start over">Next</button>
  </div>
</div>
```

```css
/* Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license */
/* Kodza — Stepper
   A flow in a few steps: the line fills up to the current step, a check draws itself on each
   finished one, and the content slides in from the side you are heading to. Finished steps
   can be clicked to go back. The last panel (.kodza-stepper__done) is shown once it is all done.
   Everything is tuned with the --kz-stepper-* variables. */
.kodza-stepper {
  --kz-stepper-bg: #ffffff;
  --kz-stepper-fg: #0a0a0a;
  --kz-stepper-muted: rgba(10, 10, 10, 0.6);
  --kz-stepper-border: rgba(10, 10, 10, 0.1);
  --kz-stepper-line: rgba(10, 10, 10, 0.12);
  --kz-stepper-ink: #0a0a0a;
  --kz-stepper-on-ink: #ffffff;
  --kz-stepper-dot: 28px;
  --kz-stepper-duration: 0.6s;
  --kz-stepper-ease: cubic-bezier(0.22, 1, 0.36, 1);

  display: grid;
  gap: 28px;
  width: 100%;
  max-width: 520px;
  padding: 28px;
  border-radius: 16px;
  background: var(--kz-stepper-bg);
  box-shadow: inset 0 0 0 1px var(--kz-stepper-border);
  color: var(--kz-stepper-fg);
  box-sizing: border-box;
}

/* The steps, and the line that joins their centres */
.kodza-stepper__steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--kz-stepper-n, 4), minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.kodza-stepper__steps::before,
.kodza-stepper__steps::after {
  content: "";
  position: absolute;
  top: calc(var(--kz-stepper-dot) / 2 - 1px);
  left: calc(50% / var(--kz-stepper-n, 4));
  right: calc(50% / var(--kz-stepper-n, 4));
  height: 2px;
  border-radius: 2px;
  background: var(--kz-stepper-line);
}

/* The filled part only scales */
.kodza-stepper__steps::after {
  background: var(--kz-stepper-ink);
  transform: scaleX(var(--kz-stepper-progress, 0));
  transform-origin: left;
  transition: transform var(--kz-stepper-duration) var(--kz-stepper-ease);
}

.kodza-stepper__step {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 8px;
}

.kodza-stepper__dot {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--kz-stepper-dot);
  height: var(--kz-stepper-dot);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--kz-stepper-bg);
  box-shadow: inset 0 0 0 1.5px var(--kz-stepper-line);
  color: var(--kz-stepper-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: background-color 0.35s ease, box-shadow 0.35s ease, color 0.35s ease;
}

.kodza-stepper__dot:disabled {
  cursor: default;
}

.kodza-stepper__dot:not(:disabled) {
  cursor: pointer;
}

.kodza-stepper__dot:focus-visible {
  outline: 2px solid var(--kz-stepper-fg);
  outline-offset: 3px;
}

.kodza-stepper__step.is-current .kodza-stepper__dot,
.kodza-stepper__step.is-done .kodza-stepper__dot {
  background: var(--kz-stepper-ink);
  box-shadow: none;
  color: var(--kz-stepper-on-ink);
}

.kodza-stepper__num,
.kodza-stepper__check {
  grid-area: 1 / 1;
}

.kodza-stepper__num {
  transition: opacity 0.2s ease, transform 0.35s var(--kz-stepper-ease);
}

.kodza-stepper__check {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.4s var(--kz-stepper-ease);
}

/* A finished step: the number leaves, the check draws itself */
.kodza-stepper__step.is-done .kodza-stepper__num {
  opacity: 0;
  transform: scale(0.6);
}

.kodza-stepper__step.is-done .kodza-stepper__check {
  stroke-dashoffset: 0;
  transition-delay: 0.15s;
}

.kodza-stepper__label {
  font-size: 14px;
  font-weight: 500;
  color: var(--kz-stepper-muted);
  transition: color 0.35s ease;
}

.kodza-stepper__step.is-current .kodza-stepper__label,
.kodza-stepper__step.is-done .kodza-stepper__label {
  color: var(--kz-stepper-fg);
}

/* The content: the panels are stacked, so the card keeps the height of the tallest one and
   nothing under it moves. The old panel leaves on one side while the new one comes in from
   the side you are heading to. */
.kodza-stepper__panels {
  display: grid;
}

.kodza-stepper__panel {
  grid-area: 1 / 1;
}

.kodza-stepper.is-ready .kodza-stepper__panel[hidden] {
  display: block;
}

.kodza-stepper.is-ready .kodza-stepper__panel {
  visibility: hidden;
  opacity: 0;
  transform: translateX(calc(var(--kz-stepper-leave, -1) * 20px));
  transition:
    opacity 0.22s ease,
    transform 0.32s ease-in,
    visibility 0s linear 0.32s;
}

.kodza-stepper.is-ready .kodza-stepper__panel.is-active {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition:
    opacity 0.45s ease 0.16s,
    transform var(--kz-stepper-duration) var(--kz-stepper-ease) 0.16s,
    visibility 0s;
}

/* Where the new panel starts from, set for an instant before it comes in */
.kodza-stepper.is-ready .kodza-stepper__panel.is-from {
  transform: translateX(calc(var(--kz-stepper-leave, -1) * -28px));
  transition: none;
}

.kodza-stepper__title {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

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

/* The button label rolls to its new word; the button keeps the width of the longest one */
.kodza-stepper__roll {
  display: inline-grid;
  overflow: hidden;
  vertical-align: top;
}

.kodza-stepper__roll > span {
  grid-area: 1 / 1;
}

.kodza-stepper__actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.kodza-stepper__back,
.kodza-stepper__next {
  height: 40px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: opacity 0.25s ease, box-shadow 0.25s ease;
}

.kodza-stepper__back {
  background: none;
  box-shadow: inset 0 0 0 1px var(--kz-stepper-border);
  color: var(--kz-stepper-fg);
}

.kodza-stepper__back:hover {
  box-shadow: inset 0 0 0 1px var(--kz-stepper-muted);
}

.kodza-stepper__back:disabled {
  opacity: 0;
  pointer-events: none;
}

.kodza-stepper__next {
  background: var(--kz-stepper-ink);
  color: var(--kz-stepper-on-ink);
}

.kodza-stepper__back:focus-visible,
.kodza-stepper__next:focus-visible {
  outline: 2px solid var(--kz-stepper-fg);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .kodza-stepper__steps::after,
  .kodza-stepper__dot,
  .kodza-stepper__num,
  .kodza-stepper__check,
  .kodza-stepper__label {
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }

  .kodza-stepper.is-ready .kodza-stepper__panel,
  .kodza-stepper.is-ready .kodza-stepper__panel.is-active {
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}

/* Theming example — on a dark background:
.dark-section .kodza-stepper {
  --kz-stepper-bg: #161616;
  --kz-stepper-fg: #f2f2f0;
  --kz-stepper-muted: rgba(242, 242, 240, 0.58);
  --kz-stepper-border: rgba(255, 255, 255, 0.12);
  --kz-stepper-line: rgba(255, 255, 255, 0.16);
  --kz-stepper-ink: #f2f2f0;
  --kz-stepper-on-ink: #161616;
}
*/

/* kodza-guard 523704681d02 — 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-stepper__dot):not(#_),
:where(.kodza-stepper__back):not(#_),
:where(.kodza-stepper__next):not(#_) {
  outline: revert;
  outline-offset: revert;
}

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

.kodza-stepper__steps:not(#_) {
  border: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  transition: revert;
  box-sizing: revert;
  float: 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-stepper__step:not(#_) {
  border: revert;
  margin: revert;
  padding: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  transition: revert;
  list-style: revert;
  box-sizing: revert;
  float: 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-stepper__dot:not(#_) {
  margin: revert;
  text-decoration: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  letter-spacing: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
  min-height: revert;
}

.kodza-stepper__num:not(#_),
.kodza-stepper__label:not(#_),
.kodza-stepper__panels:not(#_),
.kodza-stepper__panel:not(#_),
.kodza-stepper__actions:not(#_),
.kodza-stepper__roll:not(#_),
.kodza-stepper__roll span:where(:not([class*="kodza-"])):not(#_) {
  box-sizing: revert;
}

.kodza-stepper__check: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-stepper__title:not(#_) {
  border: revert;
  padding: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  transition: 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-stepper__text:not(#_) {
  border: revert;
  padding: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  transition: 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-stepper__back:not(#_) {
  margin: revert;
  text-decoration: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  position: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  letter-spacing: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
  min-height: revert;
}

.kodza-stepper__next:not(#_) {
  margin: revert;
  text-decoration: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  position: revert;
  box-shadow: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  letter-spacing: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
  min-height: revert;
}

.kodza-stepper__check:not(#_):where(:not([hidden])),
.kodza-stepper__title:not(#_):where(:not([hidden])),
.kodza-stepper__text:not(#_):where(:not([hidden])),
.kodza-stepper__back:not(#_):where(:not([hidden])),
.kodza-stepper__next:not(#_):where(:not([hidden])) {
  display: revert;
}

.kodza-stepper__check:not(#_):where([hidden]),
.kodza-stepper__title:not(#_):where([hidden]),
.kodza-stepper__text:not(#_):where([hidden]),
.kodza-stepper__back:not(#_):where([hidden]),
.kodza-stepper__next:not(#_):where([hidden]) {
  display: none;
}

.kodza-stepper__steps:not(#_)::before,
.kodza-stepper__steps:not(#_)::after {
  box-sizing: revert;
}

/* 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-stepper:not(#_) {
  width: min(100%, 520px);
}

.kodza-stepper__steps:not(#_) {
  position: relative;
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.kodza-stepper__step:not(#_) {
  position: relative;
  display: grid;
}

.kodza-stepper__dot:not(#_) {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--kz-stepper-dot);
  height: var(--kz-stepper-dot);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--kz-stepper-bg);
  box-shadow: inset 0 0 0 1.5px var(--kz-stepper-line);
  color: var(--kz-stepper-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: background-color 0.35s ease, box-shadow 0.35s ease, color 0.35s ease;
}

.kodza-stepper__dot:disabled:not(#_) {
  cursor: default;
}

.kodza-stepper__dot:not(:disabled):not(#_) {
  cursor: pointer;
}

.kodza-stepper__dot:focus-visible:not(#_) {
  outline: 2px solid var(--kz-stepper-fg);
  outline-offset: 3px;
}

.kodza-stepper__step.is-current .kodza-stepper__dot:not(#_),
.kodza-stepper__step.is-done .kodza-stepper__dot:not(#_) {
  background: var(--kz-stepper-ink);
  box-shadow: none;
  color: var(--kz-stepper-on-ink);
}

.kodza-stepper__check:not(#_) {
  transition: stroke-dashoffset 0.4s var(--kz-stepper-ease);
}

.kodza-stepper__step.is-done .kodza-stepper__check:not(#_) {
  transition-delay: 0.15s;
}

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

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

.kodza-stepper__back:not(#_),
.kodza-stepper__next:not(#_) {
  height: 40px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: opacity 0.25s ease, box-shadow 0.25s ease;
}

.kodza-stepper__back:not(#_) {
  background: none;
  box-shadow: inset 0 0 0 1px var(--kz-stepper-border);
  color: var(--kz-stepper-fg);
}

.kodza-stepper__back:hover:not(#_) {
  box-shadow: inset 0 0 0 1px var(--kz-stepper-muted);
}

.kodza-stepper__back:disabled:not(#_) {
  opacity: 0;
  pointer-events: none;
}

.kodza-stepper__next:not(#_) {
  background: var(--kz-stepper-ink);
  color: var(--kz-stepper-on-ink);
}

.kodza-stepper__back:focus-visible:not(#_),
.kodza-stepper__next:focus-visible:not(#_) {
  outline: 2px solid var(--kz-stepper-fg);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .kodza-stepper__dot:not(#_) {
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .kodza-stepper__check:not(#_) {
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}
```

```js
// Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license
// Kodza — Stepper
// Moves between the steps (Next, Back, or a click on a finished step), fills the line, marks
// the steps and swaps the panels: the old one leaves while the new one comes in from the side
// you are heading to. After the last step, Next shows the .kodza-stepper__done panel and
// becomes "Start over", its label rolling to the new word. Fires "kodza:step" with { step }
// (0-based; steps.length means done).
(() => {
  const SELECTOR = '.kodza-stepper';
  const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;

  // One instance. Everything it starts is tied to `signal`, so kodza:destroy stops it all
  function mount(root, signal) {
    const steps = [...root.querySelectorAll('.kodza-stepper__step')];
    const panels = [...root.querySelectorAll('.kodza-stepper__panel:not(.kodza-stepper__done)')];
    const done = root.querySelector('.kodza-stepper__done');
    const back = root.querySelector('.kodza-stepper__back');
    const next = root.querySelector('.kodza-stepper__next');
    if (!steps.length || !next) return;
    const all = [...panels, done].filter(Boolean);
    const labels = { next: next.textContent.trim(), last: next.dataset.last || 'Finish', again: next.dataset.again || 'Start over' };
    const style = getComputedStyle(root);
    const duration = parseFloat(style.getPropertyValue('--kz-stepper-duration')) * 1000 || 600;
    const ease = style.getPropertyValue('--kz-stepper-ease').trim() || 'ease';
    root.style.setProperty('--kz-stepper-n', steps.length);

    // The label sits in a little window, and the button is as wide as its longest label
    const roll = document.createElement('span');
    roll.className = 'kodza-stepper__roll';
    const word = document.createElement('span');
    word.textContent = labels.next;
    roll.append(word);
    next.replaceChildren(roll);
    next.style.minWidth = `${Math.max(...[labels.next, labels.last, labels.again].map((text) => {
      word.textContent = text;
      return next.offsetWidth;
    }))}px`;
    word.textContent = labels.next;

    const setLabel = (text) => {
      const prev = roll.lastElementChild;
      if (prev.textContent === text) return;
      const span = document.createElement('span');
      span.textContent = text;
      roll.append(span);
      if (reduceMotion) return prev.remove();
      prev.setAttribute('aria-hidden', 'true');
      prev.animate([{ transform: 'none' }, { transform: 'translateY(-110%)' }], { duration: duration * 0.8, easing: ease, fill: 'forwards' }).finished.then(() => prev.remove());
      span.animate([{ transform: 'translateY(110%)' }, { transform: 'none' }], { duration: duration * 0.8, easing: ease });
    };

    let current = -1;
    const go = (index) => {
      const target = Math.max(0, Math.min(steps.length, index));
      if (target === current) return;
      const forward = target > current;
      const finished = target === steps.length;
      steps.forEach((step, i) => {
        step.classList.toggle('is-done', i < target);
        step.classList.toggle('is-current', i === target);
        const dot = step.querySelector('.kodza-stepper__dot');
        const label = step.querySelector('.kodza-stepper__label')?.textContent.trim() || `Step ${i + 1}`;
        dot.disabled = i >= target;
        dot.setAttribute('aria-label', `${label}, step ${i + 1} of ${steps.length}${i < target ? ', done' : i === target ? ', current' : ''}`);
        if (i === target) step.setAttribute('aria-current', 'step');
        else step.removeAttribute('aria-current');
      });
      root.style.setProperty('--kz-stepper-progress', steps.length > 1 ? Math.min(target, steps.length - 1) / (steps.length - 1) : 1);

      // The old panel leaves on the side you come from, the new one enters from the other
      const show = finished ? done : panels[target];
      root.style.setProperty('--kz-stepper-leave', forward ? -1 : 1);
      all.forEach((panel) => {
        if (panel !== show) panel.classList.remove('is-active');
      });
      if (show) {
        if (current >= 0) {
          show.classList.add('is-from');
          void show.offsetWidth;
          show.classList.remove('is-from');
        }
        show.classList.add('is-active');
      }

      if (back) back.disabled = target === 0 || finished;
      setLabel(finished ? labels.again : target === steps.length - 1 ? labels.last : labels.next);
      current = target;
      root.dispatchEvent(new CustomEvent('kodza:step', { detail: { step: target }, bubbles: true }));
    };

    next.addEventListener('click', () => go(current === steps.length ? 0 : current + 1), { signal });
    back?.addEventListener('click', () => go(current - 1), { signal });
    steps.forEach((step, i) => step.querySelector('.kodza-stepper__dot')?.addEventListener('click', () => go(i), { signal }));

    // From here, the panels are shown by the script (stacked), not by the hidden attribute
    all.forEach((panel) => panel.removeAttribute('hidden'));
    root.classList.add('is-ready');
    go(0);
  }

  // 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).
