Skip to content
Page

Progress Stepper

Compact progress through a multi-step flow.

  1. Account
  2. Profile
  3. Complete
import {
ProgressStepper,
ProgressStepperList,
ProgressStepperItem,
ProgressStepperMarker,
ProgressStepperLabel,
} from "@pelagornis/page/components";

The preview above renders this file. Copy it into src/components/ to start from it.

src/components/ProgressStepperExample.tsx
import { useState } from "react";
import {
ProgressStepper,
ProgressStepperItem,
ProgressStepperLabel,
ProgressStepperList,
ProgressStepperMarker,
} from "@pelagornis/page/components";
const steps = ["Account", "Profile", "Complete"];
export default function ProgressStepperDemo() {
const [step, setStep] = useState(2);
return (
<ProgressStepper value={step} onValueChange={setStep} className="w-full">
<ProgressStepperList>
{steps.map((label, index) => (
<ProgressStepperItem key={label} value={index + 1}>
<ProgressStepperMarker />
<ProgressStepperLabel>{label}</ProgressStepperLabel>
</ProgressStepperItem>
))}
</ProgressStepperList>
</ProgressStepper>
);
}

Progress Stepper is composed from parts that share React state. Children written in MDX are rendered as separate islands, so the parts can’t reach each other. Put the composition in a .tsx file, like the example above, and import that file instead.

src/content/docs/example.mdx
---
title: Example
---
import ProgressStepperExample from "../../components/ProgressStepperExample";
<ProgressStepperExample client:load />

client:load hydrates the island on page load. Use client:visible for content far down the page.

Markdoc tags render Astro components, and this one needs client state. Wrap the example in an .astro file that hydrates it, then register that file as a tag.

src/components/markdoc/ProgressStepperExample.astro
---
import ProgressStepperExample from "../ProgressStepperExample";
---
<ProgressStepperExample client:load />
markdoc.config.mjs
import { component, defineMarkdocConfig } from "@astrojs/markdoc/config";
import starlightMarkdoc from "@astrojs/starlight-markdoc";
import pageMarkdoc from "@pelagornis/page/markdoc";
export default defineMarkdocConfig({
extends: [starlightMarkdoc(), pageMarkdoc()],
tags: {
"progress-stepper-example": {
render: component("./src/components/markdoc/ProgressStepperExample.astro"),
selfClosing: true,
},
},
});
src/content/docs/example.mdoc
{% progress-stepper-example /%}

Parts of the component and the data-refineui role each one renders.

PartRole
rootprogress-stepper
fillprogress-stepper-fill
itemprogress-stepper-item
labelprogress-stepper-label
listprogress-stepper-list
list_wrapprogress-stepper-list-wrap
markerprogress-stepper-marker
trackprogress-stepper-track

States the component styles. Component states are exposed as data attributes.

KindStates
data-statecomplete current upcoming