Stepper

Multi-step wizard with a new compositional StepperList, StepperStep, and StepperContent API.

v0.3.0 overhauled the Stepper. It still binds the active step with @bind-CurrentStep, and a new compositional mode lets you place step headers and content manually. The old data-driven StepItems mode still works.

What changed from v0.2.x

v0.2.1 v0.3.0
Data-driven only Data-driven or compositional mode
No sub-components StepperList, StepperStep, StepperContent

Installation

bash
shellui add stepper

stepper-list, stepper-step, stepper-content and stepper-models (the StepItem class) are auto-installed as dependencies.

Changed in 0.4.0-alpha.3 (CLI)

The CLI template gains the data-driven StepItems mode, and the parts read the stepper's active step themselves, so they no longer take a CurrentStep parameter. Keep @bind-CurrentStep on <Stepper>; remove CurrentStep from StepperStep and StepperContent after shellui update.

Usage

Account

Create your account

Profile

Set up your profile

Review

Review and submit

<Stepper @bind-CurrentStep="_step">
    <StepperList>
        <StepperStep Value="0" Title="Account" Description="Create your account" />
        <StepperStep Value="1" Title="Profile" Description="Set up your profile" />
        <StepperStep Value="2" Title="Review" Description="Review and submit" />
    </StepperList>

    <StepperContent Value="0">
        <div class="space-y-3 mt-6">
            <Input Placeholder="Email" />
            <Input Type="password" Placeholder="Password" />
        </div>
    </StepperContent>

    <StepperContent Value="1">
        <div class="space-y-3 mt-6">
            <Input Placeholder="Full Name" />
            <Textarea Placeholder="Bio" />
        </div>
    </StepperContent>

    <StepperContent Value="2">
        <div class="mt-6 rounded-md border p-4 text-sm">
            <p>Review your information and click Finish.</p>
        </div>
    </StepperContent>
</Stepper>

@code {
    private int _step = 0;
}

Data-driven mode (still works)

Account

Set up your account

Profile

Complete your profile

Done

<Stepper StepItems="@_steps" @bind-CurrentStep="_step" />

@code {
    private int _step = 0;

    private List<StepItem> _steps = new()
    {
        new()
        {
            Title = "Account",
            Description = "Set up your account",
            Content = @<div><Input Placeholder="Email" /></div>
        },
        new()
        {
            Title = "Profile",
            Description = "Complete your profile",
            Content = @<div><Input Placeholder="Full Name" /></div>
        },
        new()
        {
            Title = "Done",
            Content = @<p>All set!</p>
        }
    };
}

Stepper inside a Dialog

Start wizard
<Dialog>
    <DialogTrigger>Start wizard</DialogTrigger>
    <DialogContent>
        <DialogHeader>
            <DialogTitle>Setup wizard</DialogTitle>
        </DialogHeader>
        <Stepper @bind-CurrentStep="_step">
            <StepperList>
                <StepperStep Value="0" Title="Step 1" />
                <StepperStep Value="1" Title="Step 2" />
            </StepperList>
            <StepperContent Value="0"><p>Step 1 content</p></StepperContent>
            <StepperContent Value="1"><p>Step 2 content</p></StepperContent>
        </Stepper>
    </DialogContent>
</Dialog>

@code { private int _step = 0; }

API Reference

<Stepper>

Parameter Type Default Description
CurrentStep int 0 Active step index (use @bind-CurrentStep)
CurrentStepChanged EventCallback<int> — Fired on step change
StepItems List<StepItem>? null Data-driven mode items
Class string? null Additional CSS classes
ChildContent RenderFragment? null Compositional mode content

<StepperList>

Parameter Type Default Description
ChildContent RenderFragment — StepperStep headers

<StepperStep>

Parameter Type Default Description
Value string "0" Zero-based step index
Title string — Step label
Description string? null Secondary label

<StepperContent>

Parameter Type Default Description
Value string "0" Shown when it matches the parent's CurrentStep
ChildContent RenderFragment — Step panel content

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.