---
title: "Scroll walkthrough"
subtitle: "<ScrollWalkthrough> (alias <Walkthrough>) explains code as the reader scrolls; the code panel follows the current step."
---

A scroll-driven walkthrough (alias `<Walkthrough>`): steps on the left, and on the right a code panel that highlights along with the current step. Each fenced code block is a file in the panel (the text after the language is the file name).

````mdx
<ScrollWalkthrough>
  <Step title="Create the client" file="deploy.ts" focus="1-3">
    Read the API key and platform URL.
  </Step>
  <Step title="Upload" focus="5-10">
    Upload the source as a gzip tarball and get back a deployment id.
  </Step>
  <Step title="Wait for completion" focus="12-17">
    Poll the status every second until it's ready or failed.
  </Step>

  ```ts deploy.ts
  const api = process.env.BITI_API ?? "https://console.butterix.com";
  …
  ```
</ScrollWalkthrough>
````

<ScrollWalkthrough>
  <Step title="Create the client" file="deploy.ts" focus="1-3">
    Read the API key and platform URL.
  </Step>
  <Step title="Upload" focus="5-10">
    Upload the source as a gzip tarball and get back a deployment id.
  </Step>
  <Step title="Wait for completion" focus="12-17">
    Poll the status every second until it's ready or failed.
  </Step>

  ```ts deploy.ts
  const api = process.env.BITI_API ?? "https://console.butterix.com";
  const token = process.env.BITI_TOKEN!;
  const headers = { authorization: `Bearer ${token}` };

  const res = await fetch(`${api}/api/v1/sites/acme-payments/deployments`, {
    method: "POST",
    headers: { ...headers, "content-type": "application/gzip", "x-biti-preview": "1" },
    body: await readFile("site.tgz"),
  });
  const { id } = await res.json();

  for (;;) {
    await new Promise((r) => setTimeout(r, 1000));
    const d = await (await fetch(`${api}/api/v1/deployments/${id}`, { headers })).json();
    if (d.status === "ready") { console.log(d.url); break; }
    if (d.status === "failed") throw new Error(d.error);
  }
  ```
</ScrollWalkthrough>

<ParamField path="layout" type="default | wide" default="default">`wide` makes the code panel wider.</ParamField>
<ParamField path="panelHeight" type="string">Height of the code panel, e.g. `32rem`.</ParamField>
<ParamField path="stickyHeaders" type="boolean" default="true">Keep step titles fixed while substeps scroll.</ParamField>
<ParamField path="dim" type="boolean" default="true">Dim steps that aren't current.</ParamField>
<ParamField path="substepStyle" type="step | bullet" default="step">Number substeps or use bullets.</ParamField>

Here `<Step>` additionally supports `file` (a file name or zero-based index), `focus`, `highlight`, and `startLine`; inside a step you can nest `<Substep title file focus highlight startLine id>` (alias `<SubStep>`) for finer breakdowns.
