Define

How to define a stepper using defineStepper

defineStepper is the core function for creating a customizable stepper. It generates the necessary components and hooks for building your stepper UI and managing its state.

Usage

Import

import {  } from "@stepperize/react";

Define steps

Call defineStepper with your step configurations:

const { , ,  } = (
  { : "step-1", : "Step 1", : "First step" },
  { : "step-2", : "Step 2", : "Second step" },
  { : "step-3", : "Step 3", : "Third step" }
);
  • id (required): Unique identifier for each step
  • Add any custom properties (e.g., title, description) for use in your UI

Return Value

defineStepper returns an object with:

  • Scoped: A Provider component for scoping stepper state
  • useStepper: A custom hook for accessing and controlling the stepper
  • steps: An array of the defined step objects
  • utils: Pure utility functions for working with steps

Next Steps

Learn how to use the returned components and hooks:

Edit on GitHub

Last updated on

On this page