Skip to content

ButterIX v1 is out: versions, multiple languages, Ask AI, and a per-site MCP server, all built in. →

Scroll walkthrough

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

<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>
  1. 1

    Create the client

    Read the API key and platform URL.

  2. 2

    Upload

    Upload the source as a gzip tarball and get back a deployment id.

  3. 3

    Wait for completion

    Poll the status every second until it's ready or failed.

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);
}
layoutdefault | wideDefault default
wide makes the code panel wider.
panelHeightstring
Height of the code panel, e.g. 32rem.
stickyHeadersbooleanDefault true
Keep step titles fixed while substeps scroll.
dimbooleanDefault true
Dim steps that aren't current.
substepStylestep | bulletDefault step
Number substeps or use bullets.

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.