Skip to main content

Common Examples

import { Stepper } from "@servicetitan/anvil2";

function ExampleComponent() {
  return (
    <Stepper>
      <Stepper.List>
        <Stepper.Step id="t1" controls="p1">
          First Step
        </Stepper.Step>
        <Stepper.Step id="t2" controls="p2">
          Second Step
        </Stepper.Step>
      </Stepper.List>
      <Stepper.Panel id="p1">{/* panel content */}</Stepper.Panel>
      <Stepper.Panel id="p2">{/* panel content */}</Stepper.Panel>
      <Flex gap="3" justifyContent="flex-end">
        <Stepper.PrevButton />
        <Stepper.NextButton />
      </Flex>
    </Stepper>
  );
}

Adding stepper content

Content can be added to the Stepper by using Stepper.Panel. The id on a Stepper.Panel must match with the controls on its associated Stepper.Step to ensure proper functionality and display of the content.Content can be added to the end of the Stepper by using Stepper.FinalPanel.

Preventing step on stepper next button

In some cases, validation or other asynchronous functionality needs to occur before the user progresses to the next step.To prevent the Stepper.NextButton from going to the next step on click, return either false or a Promise that resolves false to the onClick prop.
Last modified on January 23, 2026