Stepper
Multi-step wizard component for guided workflows
The Stepper component guides users through a multi-step process with clear progress indication. It is data-driven — you pass a List<StepItem> with titles, descriptions, and RenderFragment content for each step.
Installation
shellui add stepperBasic Usage
<Stepper StepItems="@steps" @bind-CurrentStep="currentStep" />
@code {
private int currentStep = 0;
private List<StepItem> steps = new()
{
new()
{
Title = "Account",
Description = "Create your account",
Content = @<div class="space-y-4">
<Input Placeholder="Email" />
<Input Placeholder="Password" Type="password" />
</div>
},
new()
{
Title = "Profile",
Description = "Set up your profile",
Content = @<div class="space-y-4">
<Input Placeholder="Full Name" />
<Textarea Placeholder="Bio" />
</div>
},
new()
{
Title = "Review",
Description = "Review and submit",
Content = @<div class="text-sm text-muted-foreground">
<p>Review your information and click Finish.</p>
</div>
}
};
}Without Built-in Navigation
Hide the default Previous/Next/Finish buttons and provide your own:
<Stepper StepItems="@steps"
@bind-CurrentStep="step"
ShowNavigation="false" />
<div class="mt-4 flex justify-between">
<Button Variant="ButtonVariant.Outline"
Disabled="@(step == 0)"
OnClick="() => step--">
Back
</Button>
@if (step < steps.Count - 1)
{
<Button OnClick="() => step++">Continue</Button>
}
else
{
<Button OnClick="HandleFinish">Submit</Button>
}
</div>
@code {
private int step = 0;
private void HandleFinish() { /* Final submission */ }
}With Completed Steps
Mark steps as completed to show a checkmark:
<Stepper StepItems="@steps" @bind-CurrentStep="current" />
@code {
private int current = 2;
private List<StepItem> steps = new()
{
new() { Title = "Details", Description = "Completed", IsCompleted = true },
new() { Title = "Payment", Description = "Completed", IsCompleted = true },
new()
{
Title = "Confirmation",
Description = "In progress",
Content = @<p>Confirm your order.</p>
}
};
}Optional Steps
Mark steps as optional:
<Stepper StepItems="@steps" @bind-CurrentStep="current" />
@code {
private int current = 0;
private List<StepItem> steps = new()
{
new() { Title = "Required Info", Content = @<p>Fill in required fields.</p> },
new() { Title = "Additional Info", IsOptional = true, Content = @<p>Optional details.</p> },
new() { Title = "Finish", Content = @<p>All done!</p> }
};
}Preventing Backward Navigation
Disable clicking on previous steps:
<Stepper StepItems="@steps"
@bind-CurrentStep="current"
AllowClickToPrevious="false" />API Reference
Stepper
| Property | Type | Default | Description |
|---|---|---|---|
StepItems | List<StepItem> | new() | List of step definitions |
CurrentStep | int | 0 | Active step index (0-based) |
CurrentStepChanged | EventCallback<int> | — | Two-way binding callback |
ShowNavigation | bool | true | Show built-in Previous/Next/Finish buttons |
AllowClickToPrevious | bool | true | Allow clicking step indicators to go back |
Class | string | "" | Additional CSS classes |
StepItem
| Property | Type | Default | Description |
|---|---|---|---|
Title | string | "" | Step title displayed in the indicator |
Description | string? | null | Optional description below the title |
Content | RenderFragment? | null | Step body content (rendered when active) |
IsCompleted | bool | false | Shows a checkmark on the step indicator |
IsOptional | bool | false | Marks the step as optional |
Accessibility
The Stepper component includes:
aria-current="step"on the active step- Step numbers announced to screen readers
- Completed steps shown with checkmark icon
- Keyboard-navigable step indicators (when
AllowClickToPreviousis true) - Semantic ordered list structure