Shadcn Stepper

    A complete stepper component built with Shadcn UI

    Documentation

    Default

    Step 1
    Step 2
    Step 3

    Step 1

    Orientation

    You can change the orientation of the stepper to horizontal or vertical.

    Step 1

    Step 1

    Step 2
    Step 3

    Optional steps

    The second step is optional and can be skipped by the user.

    Step 1
    Step 2
    Step 3

    Step 1

    Variants

    You can change the style of the stepper by passing the variant prop

    Step 1
    Step 2
    Step 3

    Step 1

    Sizes

    Step 1
    Step 2
    Step 3

    Step 1

    Responsive

    By using the orientation prop you are able to switch between horizontal (default) and vertical orientations. By default, when in mobile view the Steps component will switch to vertical orientation. You are also able to customize the breakpoint at which the component switches to vertical orientation by using the mobileBreakpoint prop.

    State

    Sometimes it is useful to display visual feedback to the user depending on some asynchronous logic. In this case we can use the state prop to display a loading or error indicator with the values of loading | error. This prop can be used globally within the Stepper component or locally in the Step component affected by this state.

    Step 1
    Step 2
    Step 3

    Step 1

    Custom Icons

    If you want to show custom icons instead of the default numerical indicators, you can do so by using the icon prop on the Step component. To change the general check and error icons, we can use the `checkIcon` and `errorIcon` prop inside the Stepper component

    Step 1
    Step 2
    Step 3

    Step 1

    Clickable Steps

    Step 1
    Step 2
    Step 3

    Step 1

    Footer inside the step

    Step 1

    Step 1

    Step 2
    Step 3

    Scroll Tracking

    If you would like the stepper to scroll to the active step when it is not in view you can do so using the scrollTracking prop on the Stepper component.

    For scroll tracking to make sense, the content of each step should ideally include the buttons that allow the user to move forward or backward in the stepper, since the user should be able to see the content of the active step and not need to scroll to the end of the stepper in order to move forward or backward.

    Step 1

    Step 1

    Step 2
    Step 3
    Step 4
    Step 5
    Step 6

    With Forms

    If you want to use the stepper with forms, you can do so by using the useStepper hook to control the component. This example uses the Form component of shadcn and the react-hook-form hooks to create a form with zod for validations. You can also use the component with server actions.

    Step 1Description 1
    Step 2Description 2

    This is your public display name.

    Custom styles

    Step 1
    Step 2
    Step 3

    Step 1