# Stepper

Show position and status in a form with named steps.

## Preview

stepper-preview-1.jsx

```jsx
import * as React from "react";
import { Stepper } from "@/components/ui/stepper";
import { Button } from "@/components/ui/button";
import { Card } from "@/components/ui/card";
import { Field } from "@/components/ui/field";
import { Input } from "@/components/ui/input";

export default function Example() {
  return (
    <>
      <StepperDemo />
    </>
  );
}

var stages = [
  {
    id: "details",
    title: "Details",
  },
  {
    id: "knowledge",
    title: "Knowledge",
  },
  {
    id: "review",
    title: "Review",
  },
];

var initialSteps = stages.map((step) => ({
  ...step,
  status: step.id === "details" ? "complete" : "incomplete",
}));

function Sequence({
  steps = initialSteps,
  value = "knowledge",
  onValueChange,
  orientation,
  labelPlacement,
  appearance,
  compact = false,
  blocked = false,
  panelId,
}) {
  return (
    <Stepper.Root
      aria-label="Agent setup"
      value={value}
      onValueChange={onValueChange}
      orientation={orientation}
      appearance={undefined}
      labelPlacement={undefined}
    >
      {steps.map((step, index) => {
        const content = (
          <>
            <Stepper.Indicator>{index + 1}</Stepper.Indicator>
            <span className={undefined}>
              <Stepper.Title>{step.title}</Stepper.Title>
              {step.description && (
                <Stepper.Description>{step.description}</Stepper.Description>
              )}
              {step.status === "skipped" && (
                <Stepper.Description>Skipped</Stepper.Description>
              )}
            </span>
          </>
        );
        return (
          <Stepper.Item key={step.id} value={step.id} status={step.status}>
            {onValueChange ? (
              <Stepper.Trigger
                aria-controls={panelId}
                disabled={
                  blocked || (step.id !== value && step.status !== "complete")
                }
              >
                {content}
              </Stepper.Trigger>
            ) : (
              <Stepper.Content>{content}</Stepper.Content>
            )}
            <Stepper.Separator />
          </Stepper.Item>
        );
      })}
    </Stepper.Root>
  );
}

function subscribeWidth(callback) {
  const query = window.matchMedia("(max-width: 560px)");
  query.addEventListener("change", callback);
  return () => query.removeEventListener("change", callback);
}

function isNarrow() {
  return window.matchMedia("(max-width: 560px)").matches;
}

function serverWidth() {
  return false;
}

function StepperDemo({ saveSource } = {}) {
  const [value, setValue] = React.useState("knowledge");
  const [steps, setSteps] = React.useState(initialSteps);
  const [name, setName] = React.useState("Support agent");
  const [website, setWebsite] = React.useState("https://support.example.com");
  const [errors, setErrors] = React.useState({});
  const error = value ? (errors[value] ?? "") : "";
  function setError(message) {
    if (value)
      setErrors((current) => ({
        ...current,
        [value]: message,
      }));
  }
  const [pending, setPending] = React.useState(false);
  const formRef = React.useRef(null);
  const inputRef = React.useRef(null);
  const request = React.useRef(0);
  const saving = React.useRef(false);
  const mounted = React.useRef(true);
  const focusPanel = React.useRef(false);
  const narrow = React.useSyncExternalStore(
    subscribeWidth,
    isNarrow,
    serverWidth,
  );
  const panelId = React.useId();
  React.useEffect(() => {
    mounted.current = true;
    return () => {
      mounted.current = false;
      request.current++;
    };
  }, []);
  React.useEffect(() => {
    if (focusPanel.current) {
      (inputRef.current ?? formRef.current)?.focus();
      focusPanel.current = false;
    }
  }, [value]);
  function navigate(id) {
    if (saving.current) return;
    request.current++;
    focusPanel.current = true;
    setValue(id);
  }
  function mark(id, status) {
    setSteps((current) =>
      current.map((step) =>
        step.id === id
          ? {
              ...step,
              status,
            }
          : step,
      ),
    );
  }
  function invalid(message) {
    setError(message);
    if (value) mark(value, "error");
    inputRef.current?.focus();
  }
  async function submit(event) {
    event.preventDefault();
    if (saving.current) return;
    if (value === "details") {
      if (!name.trim()) {
        invalid("Enter an agent name.");
        return;
      }
      mark("details", "complete");
      navigate("knowledge");
      return;
    }
    if (value === "knowledge") {
      try {
        const url = new URL(website);
        if (!["http:", "https:"].includes(url.protocol) || !url.hostname)
          throw new Error("Invalid website");
      } catch {
        invalid("Enter a full http:// or https:// website address.");
        return;
      }
      const currentRequest = ++request.current;
      saving.current = true;
      setError("");
      setPending(true);
      try {
        await undefined;
        if (!mounted.current || request.current !== currentRequest) return;
        mark("knowledge", "complete");
        focusPanel.current = true;
        setValue("review");
      } catch {
        if (!mounted.current || request.current !== currentRequest) return;
        mark("knowledge", "error");
        setError("Could not save your source. Your changes are kept.");
      } finally {
        if (mounted.current && request.current === currentRequest) {
          saving.current = false;
          setPending(false);
        }
      }
      return;
    }
    if (value === "review") {
      mark("review", "complete");
      navigate(null);
    }
  }
  return (
    <section
      className="stepper-example stepper-example-form"
      data-stepper-example="preview"
    >
      <Sequence
        steps={steps}
        value={value}
        onValueChange={navigate}
        blocked={pending}
        panelId={panelId}
        orientation={narrow ? "vertical" : "horizontal"}
      />
      <Card.Root
        style={{
          borderRadius: "var(--radius-surface)",
        }}
      >
        <form
          id={panelId}
          ref={formRef}
          tabIndex={-1}
          aria-label={
            value === "details"
              ? "Agent details"
              : value === "knowledge"
                ? "Add knowledge"
                : value === "review"
                  ? "Review your agent"
                  : "Agent draft created"
          }
          noValidate
          onSubmit={submit}
        >
          {value === "details" && (
            <Field.Root invalid={!!error} fullWidth>
              <Field.Label>Agent name</Field.Label>
              <Input
                ref={inputRef}
                value={name}
                required
                autoComplete="off"
                onValueChange={(next) => {
                  setName(next);
                  mark("details", "incomplete");
                  mark("review", "incomplete");
                  setError("");
                }}
              />
              {error && <Field.Error match>{error}</Field.Error>}
            </Field.Root>
          )}
          {value === "knowledge" && (
            <Field.Root invalid={!!error} fullWidth>
              <Field.Label>Website</Field.Label>
              <Input
                ref={inputRef}
                value={website}
                type="url"
                required
                autoComplete="url"
                readOnly={pending}
                onValueChange={(next) => {
                  setWebsite(next);
                  mark("knowledge", "incomplete");
                  mark("review", "incomplete");
                  setError("");
                }}
              />
              {error && <Field.Error match>{error}</Field.Error>}
            </Field.Root>
          )}
          {(value === "review" || value === null) && (
            <dl className="stepper-example-summary">
              <div>
                <dt>Name</dt>
                <dd>{name}</dd>
              </div>
              <div>
                <dt>Website</dt>
                <dd>{website}</dd>
              </div>
            </dl>
          )}
          {pending && (
            <span className="stepper-example-hidden" role="status">
              Saving…
            </span>
          )}
          {value === null && (
            <p className="stepper-example-note" role="status">
              Draft saved in this preview.
            </p>
          )}
          <div className="stepper-example-actions">
            <Button
              variant="ghost"
              disabled={pending || value === "details"}
              onClick={() =>
                navigate(
                  value === "review" || value === null
                    ? "knowledge"
                    : "details",
                )
              }
            >
              Back
            </Button>
            {value !== null && (
              <Button type="submit" variant="solid" loading={pending}>
                {pending
                  ? "Saving\u2026"
                  : value === "review"
                    ? "Create draft"
                    : error &&
                        steps.find((step) => step.id === value)?.status ===
                          "error" &&
                        error.startsWith("Could not save")
                      ? "Try again"
                      : "Continue"}
              </Button>
            )}
          </div>
        </form>
      </Card.Root>
    </section>
  );
}

```

stepper-preview-1.css

```css
/* apps/web/src/demos/stepper-examples.css */
.stepper-example {
  width: 100%;
  max-width: 26rem;
  font-family: var(--font-sans);
  color: var(--foreground);
}
.stepper-example-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-2);
}
.stepper-example form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.stepper-example form:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: var(--space-1);
  border-radius: var(--radius-sm);
}
.stepper-example-actions {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  padding-top: var(--space-4);
}
.stepper-example-summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
}
.stepper-example-summary > div {
  display: flex;
  gap: var(--space-4);
}
.stepper-example-summary dt {
  width: 4rem;
  flex-shrink: 0;
  color: var(--muted-foreground);
}
.stepper-example-summary dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.stepper-example-note {
  color: var(--muted-foreground);
  font-size: var(--font-size-sm);
}
.stepper-example-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

```

## Design guidance

Use Stepper for known form stages. Use Progress for measured work and Number field to edit a number. A step's position does not prove completion: pass its status separately. A skipped step has no checkmark. Horizontal labels stay on one line; the list scrolls when the steps do not fit. Use vertical steps for long labels or a narrow form.

The form owns validation, entered values, save requests and submit. Keep the current step on failure. Preserve values when users go back. After a step change, focus its field or named form. On invalid submit, focus the invalid field. The preview saves a local draft; it makes no network request. Stepper itself has no form, routing or storage dependency.

Ghost is the default. Choose subtle for filled markers or outline for a border around each marker. All three use the shared control corners and keep the same position and status rules.

## Installation

```sh
npx shadcn@latest add https://ghost-ui.com/r/stepper.json
```

For a package install, import Stepper from @collectivecreation/ghost-ui/components/stepper. Load both @collectivecreation/ghost-ui/styles.css and @collectivecreation/ghost-ui/components.css.

## Basic usage

stepper-basic-usage-2.jsx

```jsx
import { Stepper } from "@/components/ui/stepper";

export default function Example() {
  return (
    <div className="stepper-example">
      <Sequence />
    </div>
  );
}

var stages = [
  {
    id: "details",
    title: "Details",
  },
  {
    id: "knowledge",
    title: "Knowledge",
  },
  {
    id: "review",
    title: "Review",
  },
];

var initialSteps = stages.map((step) => ({
  ...step,
  status: step.id === "details" ? "complete" : "incomplete",
}));

function Sequence({
  steps = initialSteps,
  value = "knowledge",
  onValueChange,
  orientation,
  labelPlacement,
  appearance,
  compact = false,
  blocked = false,
  panelId,
}) {
  return (
    <Stepper.Root
      aria-label="Agent setup"
      value={"knowledge"}
      onValueChange={undefined}
      orientation={undefined}
      appearance={undefined}
      labelPlacement={undefined}
    >
      {steps.map((step, index) => {
        const content = (
          <>
            <Stepper.Indicator>{index + 1}</Stepper.Indicator>
            <span className={undefined}>
              <Stepper.Title>{step.title}</Stepper.Title>
              {step.description && (
                <Stepper.Description>{step.description}</Stepper.Description>
              )}
              {step.status === "skipped" && (
                <Stepper.Description>Skipped</Stepper.Description>
              )}
            </span>
          </>
        );
        return (
          <Stepper.Item key={step.id} value={step.id} status={step.status}>
            {undefined ? (
              <Stepper.Trigger
                aria-controls={undefined}
                disabled={step.id !== "knowledge" && step.status !== "complete"}
              >
                {content}
              </Stepper.Trigger>
            ) : (
              <Stepper.Content>{content}</Stepper.Content>
            )}
            <Stepper.Separator />
          </Stepper.Item>
        );
      })}
    </Stepper.Root>
  );
}

```

stepper-basic-usage-2.css

```css
/* apps/web/src/demos/stepper-examples.css */
.stepper-example {
  width: 100%;
  max-width: 26rem;
  font-family: var(--font-sans);
  color: var(--foreground);
}
.stepper-example form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.stepper-example form:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: var(--space-1);
  border-radius: var(--radius-sm);
}

```

Root takes a controlled current ID. Pass null when there is no current step. Give each Item a unique stable value; its position supplies only the displayed number. Content is read-only. Replace it with Trigger and pass onValueChange to request navigation. The caller must update value.

For steps on separate pages, use Link with the real page URL and derive value from your router. The router owns navigation; Stepper does not create routes.

## Structures

- Stepper.Root · ol
  - Stepper.Item · li
    - Stepper.Content (static step)
      - Stepper.Indicator
      - Stepper.Title
      - Stepper.Description (optional)
    - Stepper.Trigger (alternative step content)
      - Stepper.Indicator
      - Stepper.Title
      - Stepper.Description (optional)
    - Stepper.Link (alternative step content)
      - Stepper.Indicator
      - Stepper.Title
      - Stepper.Description (optional)
    - Stepper.Separator

Keep each separator inside its item. It is decorative and hides on the last item. Group the title and description in a span when both appear. Trigger composes Ghost Button. Link composes Ghost Link and the public Button styling recipe; it keeps native link semantics, a real href and modified-click behavior. Use native Tab, Enter and Space; Stepper does not use tab roles or arrow-key selection. One list item exposes aria-current="step"; the trigger describes the item's status.

## Examples

### Subtle

stepper-subtle-3.jsx

```jsx
import { Stepper } from "@/components/ui/stepper";

export default function Example() {
  return (
    <div className="stepper-example">
      <Sequence appearance="subtle" />
    </div>
  );
}

var stages = [
  {
    id: "details",
    title: "Details",
  },
  {
    id: "knowledge",
    title: "Knowledge",
  },
  {
    id: "review",
    title: "Review",
  },
];

var initialSteps = stages.map((step) => ({
  ...step,
  status: step.id === "details" ? "complete" : "incomplete",
}));

function Sequence({
  steps = initialSteps,
  value = "knowledge",
  onValueChange,
  orientation,
  labelPlacement,
  appearance,
  compact = false,
  blocked = false,
  panelId,
}) {
  return (
    <Stepper.Root
      aria-label="Agent setup"
      value={"knowledge"}
      onValueChange={undefined}
      orientation={undefined}
      appearance={"subtle"}
      labelPlacement={undefined}
    >
      {steps.map((step, index) => {
        const content = (
          <>
            <Stepper.Indicator>{index + 1}</Stepper.Indicator>
            <span className={undefined}>
              <Stepper.Title>{step.title}</Stepper.Title>
              {step.description && (
                <Stepper.Description>{step.description}</Stepper.Description>
              )}
              {step.status === "skipped" && (
                <Stepper.Description>Skipped</Stepper.Description>
              )}
            </span>
          </>
        );
        return (
          <Stepper.Item key={step.id} value={step.id} status={step.status}>
            {undefined ? (
              <Stepper.Trigger
                aria-controls={undefined}
                disabled={step.id !== "knowledge" && step.status !== "complete"}
              >
                {content}
              </Stepper.Trigger>
            ) : (
              <Stepper.Content>{content}</Stepper.Content>
            )}
            <Stepper.Separator />
          </Stepper.Item>
        );
      })}
    </Stepper.Root>
  );
}

```

stepper-subtle-3.css

```css
/* apps/web/src/demos/stepper-examples.css */
.stepper-example {
  width: 100%;
  max-width: 26rem;
  font-family: var(--font-sans);
  color: var(--foreground);
}
.stepper-example form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.stepper-example form:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: var(--space-1);
  border-radius: var(--radius-sm);
}

```

### Outline

stepper-outline-4.jsx

```jsx
import { Stepper } from "@/components/ui/stepper";

export default function Example() {
  return (
    <div className="stepper-example">
      <Sequence appearance="outline" />
    </div>
  );
}

var stages = [
  {
    id: "details",
    title: "Details",
  },
  {
    id: "knowledge",
    title: "Knowledge",
  },
  {
    id: "review",
    title: "Review",
  },
];

var initialSteps = stages.map((step) => ({
  ...step,
  status: step.id === "details" ? "complete" : "incomplete",
}));

function Sequence({
  steps = initialSteps,
  value = "knowledge",
  onValueChange,
  orientation,
  labelPlacement,
  appearance,
  compact = false,
  blocked = false,
  panelId,
}) {
  return (
    <Stepper.Root
      aria-label="Agent setup"
      value={"knowledge"}
      onValueChange={undefined}
      orientation={undefined}
      appearance={"outline"}
      labelPlacement={undefined}
    >
      {steps.map((step, index) => {
        const content = (
          <>
            <Stepper.Indicator>{index + 1}</Stepper.Indicator>
            <span className={undefined}>
              <Stepper.Title>{step.title}</Stepper.Title>
              {step.description && (
                <Stepper.Description>{step.description}</Stepper.Description>
              )}
              {step.status === "skipped" && (
                <Stepper.Description>Skipped</Stepper.Description>
              )}
            </span>
          </>
        );
        return (
          <Stepper.Item key={step.id} value={step.id} status={step.status}>
            {undefined ? (
              <Stepper.Trigger
                aria-controls={undefined}
                disabled={step.id !== "knowledge" && step.status !== "complete"}
              >
                {content}
              </Stepper.Trigger>
            ) : (
              <Stepper.Content>{content}</Stepper.Content>
            )}
            <Stepper.Separator />
          </Stepper.Item>
        );
      })}
    </Stepper.Root>
  );
}

```

stepper-outline-4.css

```css
/* apps/web/src/demos/stepper-examples.css */
.stepper-example {
  width: 100%;
  max-width: 26rem;
  font-family: var(--font-sans);
  color: var(--foreground);
}
.stepper-example form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.stepper-example form:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: var(--space-1);
  border-radius: var(--radius-sm);
}

```

### Labels below

stepper-labels-below-5.jsx

```jsx
import { Stepper } from "@/components/ui/stepper";

export default function Example() {
  return (
    <div className="stepper-example">
      <Sequence labelPlacement="below" />
    </div>
  );
}

var stages = [
  {
    id: "details",
    title: "Details",
  },
  {
    id: "knowledge",
    title: "Knowledge",
  },
  {
    id: "review",
    title: "Review",
  },
];

var initialSteps = stages.map((step) => ({
  ...step,
  status: step.id === "details" ? "complete" : "incomplete",
}));

function Sequence({
  steps = initialSteps,
  value = "knowledge",
  onValueChange,
  orientation,
  labelPlacement,
  appearance,
  compact = false,
  blocked = false,
  panelId,
}) {
  return (
    <Stepper.Root
      aria-label="Agent setup"
      value={"knowledge"}
      onValueChange={undefined}
      orientation={undefined}
      appearance={undefined}
      labelPlacement={"below"}
    >
      {steps.map((step, index) => {
        const content = (
          <>
            <Stepper.Indicator>{index + 1}</Stepper.Indicator>
            <span className={undefined}>
              <Stepper.Title>{step.title}</Stepper.Title>
              {step.description && (
                <Stepper.Description>{step.description}</Stepper.Description>
              )}
              {step.status === "skipped" && (
                <Stepper.Description>Skipped</Stepper.Description>
              )}
            </span>
          </>
        );
        return (
          <Stepper.Item key={step.id} value={step.id} status={step.status}>
            {undefined ? (
              <Stepper.Trigger
                aria-controls={undefined}
                disabled={step.id !== "knowledge" && step.status !== "complete"}
              >
                {content}
              </Stepper.Trigger>
            ) : (
              <Stepper.Content>{content}</Stepper.Content>
            )}
            <Stepper.Separator />
          </Stepper.Item>
        );
      })}
    </Stepper.Root>
  );
}

```

stepper-labels-below-5.css

```css
/* apps/web/src/demos/stepper-examples.css */
.stepper-example {
  width: 100%;
  max-width: 26rem;
  font-family: var(--font-sans);
  color: var(--foreground);
}
.stepper-example form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.stepper-example form:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: var(--space-1);
  border-radius: var(--radius-sm);
}

```

### Vertical

stepper-vertical-6.jsx

```jsx
import { Stepper } from "@/components/ui/stepper";

export default function Example() {
  return (
    <div className="stepper-example stepper-example-vertical">
      <Sequence orientation="vertical" />
    </div>
  );
}

var stages = [
  {
    id: "details",
    title: "Details",
  },
  {
    id: "knowledge",
    title: "Knowledge",
  },
  {
    id: "review",
    title: "Review",
  },
];

var initialSteps = stages.map((step) => ({
  ...step,
  status: step.id === "details" ? "complete" : "incomplete",
}));

function Sequence({
  steps = initialSteps,
  value = "knowledge",
  onValueChange,
  orientation,
  labelPlacement,
  appearance,
  compact = false,
  blocked = false,
  panelId,
}) {
  return (
    <Stepper.Root
      aria-label="Agent setup"
      value={"knowledge"}
      onValueChange={undefined}
      orientation={"vertical"}
      appearance={undefined}
      labelPlacement={undefined}
    >
      {steps.map((step, index) => {
        const content = (
          <>
            <Stepper.Indicator>{index + 1}</Stepper.Indicator>
            <span className={undefined}>
              <Stepper.Title>{step.title}</Stepper.Title>
              {step.description && (
                <Stepper.Description>{step.description}</Stepper.Description>
              )}
              {step.status === "skipped" && (
                <Stepper.Description>Skipped</Stepper.Description>
              )}
            </span>
          </>
        );
        return (
          <Stepper.Item key={step.id} value={step.id} status={step.status}>
            {undefined ? (
              <Stepper.Trigger
                aria-controls={undefined}
                disabled={step.id !== "knowledge" && step.status !== "complete"}
              >
                {content}
              </Stepper.Trigger>
            ) : (
              <Stepper.Content>{content}</Stepper.Content>
            )}
            <Stepper.Separator />
          </Stepper.Item>
        );
      })}
    </Stepper.Root>
  );
}

```

stepper-vertical-6.css

```css
/* apps/web/src/demos/stepper-examples.css */
.stepper-example {
  width: 100%;
  max-width: 26rem;
  font-family: var(--font-sans);
  color: var(--foreground);
}
.stepper-example form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.stepper-example form:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: var(--space-1);
  border-radius: var(--radius-sm);
}
.stepper-example-vertical {
  max-width: 24rem;
}

```

### Descriptions

stepper-descriptions-7.jsx

```jsx
import { Stepper } from "@/components/ui/stepper";

export default function Example() {
  return (
    <div className="stepper-example stepper-example-vertical">
      <Sequence
        orientation="vertical"
        steps={initialSteps.map((step, index) => ({
          ...step,
          description: [
            "Name and purpose",
            "Websites and documents",
            "Check settings before you create",
          ][index],
        }))}
      />
    </div>
  );
}

var stages = [
  {
    id: "details",
    title: "Details",
  },
  {
    id: "knowledge",
    title: "Knowledge",
  },
  {
    id: "review",
    title: "Review",
  },
];

var initialSteps = stages.map((step) => ({
  ...step,
  status: step.id === "details" ? "complete" : "incomplete",
}));

function Sequence({
  steps = initialSteps,
  value = "knowledge",
  onValueChange,
  orientation,
  labelPlacement,
  appearance,
  compact = false,
  blocked = false,
  panelId,
}) {
  return (
    <Stepper.Root
      aria-label="Agent setup"
      value={"knowledge"}
      onValueChange={undefined}
      orientation={"vertical"}
      appearance={undefined}
      labelPlacement={undefined}
    >
      {steps.map((step, index) => {
        const content = (
          <>
            <Stepper.Indicator>{index + 1}</Stepper.Indicator>
            <span className={undefined}>
              <Stepper.Title>{step.title}</Stepper.Title>
              {step.description && (
                <Stepper.Description>{step.description}</Stepper.Description>
              )}
              {step.status === "skipped" && (
                <Stepper.Description>Skipped</Stepper.Description>
              )}
            </span>
          </>
        );
        return (
          <Stepper.Item key={step.id} value={step.id} status={step.status}>
            {undefined ? (
              <Stepper.Trigger
                aria-controls={undefined}
                disabled={step.id !== "knowledge" && step.status !== "complete"}
              >
                {content}
              </Stepper.Trigger>
            ) : (
              <Stepper.Content>{content}</Stepper.Content>
            )}
            <Stepper.Separator />
          </Stepper.Item>
        );
      })}
    </Stepper.Root>
  );
}

```

stepper-descriptions-7.css

```css
/* apps/web/src/demos/stepper-examples.css */
.stepper-example {
  width: 100%;
  max-width: 26rem;
  font-family: var(--font-sans);
  color: var(--foreground);
}
.stepper-example form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.stepper-example form:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: var(--space-1);
  border-radius: var(--radius-sm);
}
.stepper-example-vertical {
  max-width: 24rem;
}

```

### Compact

The counter reports position. The checkmark reports completion. This composition uses the same parts and data; it does not infer a percentage.

stepper-compact-8.jsx

```jsx
import { Stepper } from "@/components/ui/stepper";

export default function Example() {
  const current = initialSteps[1];
  return (
    <div className="stepper-example stepper-example-compact">
      <div>
        <span className="stepper-example-note">
          {"Step 2 of "}
          {initialSteps.length}
        </span>
        <p>{current.title}</p>
      </div>
      <Sequence value={current.id} compact />
    </div>
  );
}

var stages = [
  {
    id: "details",
    title: "Details",
  },
  {
    id: "knowledge",
    title: "Knowledge",
  },
  {
    id: "review",
    title: "Review",
  },
];

var initialSteps = stages.map((step) => ({
  ...step,
  status: step.id === "details" ? "complete" : "incomplete",
}));

function Sequence({
  steps = initialSteps,
  value = "knowledge",
  onValueChange,
  orientation,
  labelPlacement,
  appearance,
  compact = false,
  blocked = false,
  panelId,
}) {
  return (
    <Stepper.Root
      aria-label="Agent setup"
      value={value}
      onValueChange={undefined}
      orientation={undefined}
      appearance={undefined}
      labelPlacement={"below"}
    >
      {steps.map((step, index) => {
        const content = (
          <>
            <Stepper.Indicator>{index + 1}</Stepper.Indicator>
            <span className={"stepper-example-hidden"}>
              <Stepper.Title>{step.title}</Stepper.Title>
              {step.description && (
                <Stepper.Description>{step.description}</Stepper.Description>
              )}
              {step.status === "skipped" && (
                <Stepper.Description>Skipped</Stepper.Description>
              )}
            </span>
          </>
        );
        return (
          <Stepper.Item key={step.id} value={step.id} status={step.status}>
            {undefined ? (
              <Stepper.Trigger
                aria-controls={undefined}
                disabled={step.id !== value && step.status !== "complete"}
              >
                {content}
              </Stepper.Trigger>
            ) : (
              <Stepper.Content>{content}</Stepper.Content>
            )}
            <Stepper.Separator />
          </Stepper.Item>
        );
      })}
    </Stepper.Root>
  );
}

```

stepper-compact-8.css

```css
/* apps/web/src/demos/stepper-examples.css */
.stepper-example {
  width: 100%;
  max-width: 26rem;
  font-family: var(--font-sans);
  color: var(--foreground);
}
.stepper-example form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.stepper-example form:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: var(--space-1);
  border-radius: var(--radius-sm);
}
.stepper-example-note {
  color: var(--muted-foreground);
  font-size: var(--font-size-sm);
}
.stepper-example-compact {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  max-width: 20rem;
}
.stepper-example-compact p {
  margin: var(--space-1) 0 0;
  font-size: var(--font-size-lg);
}
.stepper-example-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

```

### Optional

Optional describes a choice the form permits. It does not mark the step as skipped.

stepper-optional-9.jsx

```jsx
import { Stepper } from "@/components/ui/stepper";

export default function Example() {
  return (
    <div className="stepper-example stepper-example-vertical">
      <Sequence
        orientation="vertical"
        steps={initialSteps.map((step) => ({
          ...step,
          description: step.id === "knowledge" ? "Optional" : undefined,
        }))}
      />
    </div>
  );
}

var stages = [
  {
    id: "details",
    title: "Details",
  },
  {
    id: "knowledge",
    title: "Knowledge",
  },
  {
    id: "review",
    title: "Review",
  },
];

var initialSteps = stages.map((step) => ({
  ...step,
  status: step.id === "details" ? "complete" : "incomplete",
}));

function Sequence({
  steps = initialSteps,
  value = "knowledge",
  onValueChange,
  orientation,
  labelPlacement,
  appearance,
  compact = false,
  blocked = false,
  panelId,
}) {
  return (
    <Stepper.Root
      aria-label="Agent setup"
      value={"knowledge"}
      onValueChange={undefined}
      orientation={"vertical"}
      appearance={undefined}
      labelPlacement={undefined}
    >
      {steps.map((step, index) => {
        const content = (
          <>
            <Stepper.Indicator>{index + 1}</Stepper.Indicator>
            <span className={undefined}>
              <Stepper.Title>{step.title}</Stepper.Title>
              {step.description && (
                <Stepper.Description>{step.description}</Stepper.Description>
              )}
              {step.status === "skipped" && (
                <Stepper.Description>Skipped</Stepper.Description>
              )}
            </span>
          </>
        );
        return (
          <Stepper.Item key={step.id} value={step.id} status={step.status}>
            {undefined ? (
              <Stepper.Trigger
                aria-controls={undefined}
                disabled={step.id !== "knowledge" && step.status !== "complete"}
              >
                {content}
              </Stepper.Trigger>
            ) : (
              <Stepper.Content>{content}</Stepper.Content>
            )}
            <Stepper.Separator />
          </Stepper.Item>
        );
      })}
    </Stepper.Root>
  );
}

```

stepper-optional-9.css

```css
/* apps/web/src/demos/stepper-examples.css */
.stepper-example {
  width: 100%;
  max-width: 26rem;
  font-family: var(--font-sans);
  color: var(--foreground);
}
.stepper-example form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.stepper-example form:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: var(--space-1);
  border-radius: var(--radius-sm);
}
.stepper-example-vertical {
  max-width: 24rem;
}

```

### Skipped

stepper-skipped-10.jsx

```jsx
import { Stepper } from "@/components/ui/stepper";

export default function Example() {
  return (
    <div className="stepper-example stepper-example-vertical">
      <Sequence
        orientation="vertical"
        value="review"
        steps={initialSteps.map((step) => ({
          ...step,
          status: step.id === "knowledge" ? "skipped" : step.status,
        }))}
      />
    </div>
  );
}

var stages = [
  {
    id: "details",
    title: "Details",
  },
  {
    id: "knowledge",
    title: "Knowledge",
  },
  {
    id: "review",
    title: "Review",
  },
];

var initialSteps = stages.map((step) => ({
  ...step,
  status: step.id === "details" ? "complete" : "incomplete",
}));

function Sequence({
  steps = initialSteps,
  value = "knowledge",
  onValueChange,
  orientation,
  labelPlacement,
  appearance,
  compact = false,
  blocked = false,
  panelId,
}) {
  return (
    <Stepper.Root
      aria-label="Agent setup"
      value={"review"}
      onValueChange={undefined}
      orientation={"vertical"}
      appearance={undefined}
      labelPlacement={undefined}
    >
      {steps.map((step, index) => {
        const content = (
          <>
            <Stepper.Indicator>{index + 1}</Stepper.Indicator>
            <span className={undefined}>
              <Stepper.Title>{step.title}</Stepper.Title>
              {step.description && (
                <Stepper.Description>{step.description}</Stepper.Description>
              )}
              {step.status === "skipped" && (
                <Stepper.Description>Skipped</Stepper.Description>
              )}
            </span>
          </>
        );
        return (
          <Stepper.Item key={step.id} value={step.id} status={step.status}>
            {undefined ? (
              <Stepper.Trigger
                aria-controls={undefined}
                disabled={step.id !== "review" && step.status !== "complete"}
              >
                {content}
              </Stepper.Trigger>
            ) : (
              <Stepper.Content>{content}</Stepper.Content>
            )}
            <Stepper.Separator />
          </Stepper.Item>
        );
      })}
    </Stepper.Root>
  );
}

```

stepper-skipped-10.css

```css
/* apps/web/src/demos/stepper-examples.css */
.stepper-example {
  width: 100%;
  max-width: 26rem;
  font-family: var(--font-sans);
  color: var(--foreground);
}
.stepper-example form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.stepper-example form:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: var(--space-1);
  border-radius: var(--radius-sm);
}
.stepper-example-vertical {
  max-width: 24rem;
}

```

### Revisit completed steps

Current and complete are independent. The caller allows completed steps here and blocks the unfinished step. Clicking a step does not change its status.

stepper-revisit-completed-steps-11.jsx

```jsx
import * as React from "react";
import { Stepper } from "@/components/ui/stepper";

export default function Example() {
  const [value, setValue] = React.useState("details");
  return (
    <div className="stepper-example">
      <Sequence
        value={value}
        onValueChange={setValue}
        steps={[
          {
            id: "details",
            title: "Details",
            status: "complete",
          },
          {
            id: "knowledge",
            title: "Knowledge",
            description: "Not started",
          },
          {
            id: "tools",
            title: "Tools",
            status: "complete",
          },
        ]}
      />
    </div>
  );
}

var stages = [
  {
    id: "details",
    title: "Details",
  },
  {
    id: "knowledge",
    title: "Knowledge",
  },
  {
    id: "review",
    title: "Review",
  },
];

var initialSteps = stages.map((step) => ({
  ...step,
  status: step.id === "details" ? "complete" : "incomplete",
}));

function Sequence({
  steps = initialSteps,
  value = "knowledge",
  onValueChange,
  orientation,
  labelPlacement,
  appearance,
  compact = false,
  blocked = false,
  panelId,
}) {
  return (
    <Stepper.Root
      aria-label="Agent setup"
      value={value}
      onValueChange={onValueChange}
      orientation={undefined}
      appearance={undefined}
      labelPlacement={undefined}
    >
      {steps.map((step, index) => {
        const content = (
          <>
            <Stepper.Indicator>{index + 1}</Stepper.Indicator>
            <span className={undefined}>
              <Stepper.Title>{step.title}</Stepper.Title>
              {step.description && (
                <Stepper.Description>{step.description}</Stepper.Description>
              )}
              {step.status === "skipped" && (
                <Stepper.Description>Skipped</Stepper.Description>
              )}
            </span>
          </>
        );
        return (
          <Stepper.Item key={step.id} value={step.id} status={step.status}>
            {onValueChange ? (
              <Stepper.Trigger
                aria-controls={undefined}
                disabled={step.id !== value && step.status !== "complete"}
              >
                {content}
              </Stepper.Trigger>
            ) : (
              <Stepper.Content>{content}</Stepper.Content>
            )}
            <Stepper.Separator />
          </Stepper.Item>
        );
      })}
    </Stepper.Root>
  );
}

```

stepper-revisit-completed-steps-11.css

```css
/* apps/web/src/demos/stepper-examples.css */
.stepper-example {
  width: 100%;
  max-width: 26rem;
  font-family: var(--font-sans);
  color: var(--foreground);
}
.stepper-example form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.stepper-example form:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: var(--space-1);
  border-radius: var(--radius-sm);
}

```

### Long labels

stepper-long-labels-12.jsx

```jsx
import { Stepper } from "@/components/ui/stepper";

export default function Example() {
  return (
    <div className="stepper-example stepper-example-compact">
      <Sequence
        orientation="vertical"
        steps={initialSteps.map((step, index) => ({
          ...step,
          title: [
            "Connect your knowledge sources",
            "Set agent behavior and safeguards",
            "Review access and instructions",
          ][index],
        }))}
      />
    </div>
  );
}

var stages = [
  {
    id: "details",
    title: "Details",
  },
  {
    id: "knowledge",
    title: "Knowledge",
  },
  {
    id: "review",
    title: "Review",
  },
];

var initialSteps = stages.map((step) => ({
  ...step,
  status: step.id === "details" ? "complete" : "incomplete",
}));

function Sequence({
  steps = initialSteps,
  value = "knowledge",
  onValueChange,
  orientation,
  labelPlacement,
  appearance,
  compact = false,
  blocked = false,
  panelId,
}) {
  return (
    <Stepper.Root
      aria-label="Agent setup"
      value={"knowledge"}
      onValueChange={undefined}
      orientation={"vertical"}
      appearance={undefined}
      labelPlacement={undefined}
    >
      {steps.map((step, index) => {
        const content = (
          <>
            <Stepper.Indicator>{index + 1}</Stepper.Indicator>
            <span className={undefined}>
              <Stepper.Title>{step.title}</Stepper.Title>
              {step.description && (
                <Stepper.Description>{step.description}</Stepper.Description>
              )}
              {step.status === "skipped" && (
                <Stepper.Description>Skipped</Stepper.Description>
              )}
            </span>
          </>
        );
        return (
          <Stepper.Item key={step.id} value={step.id} status={step.status}>
            {undefined ? (
              <Stepper.Trigger
                aria-controls={undefined}
                disabled={step.id !== "knowledge" && step.status !== "complete"}
              >
                {content}
              </Stepper.Trigger>
            ) : (
              <Stepper.Content>{content}</Stepper.Content>
            )}
            <Stepper.Separator />
          </Stepper.Item>
        );
      })}
    </Stepper.Root>
  );
}

```

stepper-long-labels-12.css

```css
/* apps/web/src/demos/stepper-examples.css */
.stepper-example {
  width: 100%;
  max-width: 26rem;
  font-family: var(--font-sans);
  color: var(--foreground);
}
.stepper-example form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.stepper-example form:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: var(--space-1);
  border-radius: var(--radius-sm);
}
.stepper-example-compact {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  max-width: 20rem;
}
.stepper-example-compact p {
  margin: var(--space-1) 0 0;
  font-size: var(--font-size-lg);
}

```

## API reference

### Root

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| value | string \| null | — | Required current item ID. null means no current step. The component never changes it internally. |
| onValueChange | (value: string) => void | — | Requests navigation from an enabled, non-current trigger. The caller validates, saves and updates value. Modified link clicks do not call it. |
| orientation | "horizontal" \| "vertical" | horizontal | Layout direction. Choose vertical for a narrow host or long labels. |
| labelPlacement | "inline" \| "below" | inline | Places labels beside or below indicators in a horizontal list. Vertical lists keep inline labels. |
| appearance | "ghost" \| "subtle" \| "outline" | ghost | Changes the marker surface and border. The full step stays clickable; hover, press and focus feedback stay on its marker. |

### Item and parts

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| Item.value | string | — | Required stable ID. Keep it unique within the list and preserve it when steps reorder. The caller handles removal of a current item. |
| Item.status | "incomplete" \| "complete" \| "error" \| "skipped" | incomplete | Explicit status. No completion is inferred from current position. |
| Item.statusText | string | — | Optional replacement for the accessible status description, including a translated current/status message. |
| Trigger.disabled | boolean | false | Uses Ghost Button's native disabled behavior. The caller decides whether a step is available. |
| Link.href | string | — | Required real route or fragment URL. Link composes Ghost Link, preserves native link semantics and accepts disabled plus native anchor attributes/ref. |
| Indicator.children | ReactNode | — | Number or custom content for an incomplete step. Complete, skipped and error states use their canonical markers. |
| Content / Title / Description / Separator | native attributes and ref | — | Content is a div; Title and Description are spans; Separator is an aria-hidden div. Indicator is an aria-hidden span. All parts accept className and style. |

Omit the list for empty data. A single stage usually needs only a heading. Keep progress with unknown steps outside a made-up total. Native attributes, refs and caller content remain available. Forced-color styles retain state outlines; real assistive-technology testing remains a separate check.
