Class TwStepper
- Namespace
- TwBlazor.Components
- Assembly
- TwBlazor.dll
Represents a step-by-step progress indicator for multi-step flows (e.g. checkout, onboarding wizards), showing which steps are completed, which is active, and which are still upcoming.
public class TwStepper : TwBlazorComponentBase, IComponent, IHandleEvent, IHandleAfterRender, ITwComponent
- Inheritance
-
TwStepper
- Implements
- Inherited Members
Remarks
Add TwStep children to declare each step. On Horizontal (the default), the full step row is only shown from the "sm" breakpoint up; below it, the stepper renders a compact progress bar with a "Step X of N" label instead, so the control stays usable on narrow screens without steps wrapping or overflowing. Vertical stacks steps top-to-bottom and needs no such collapse, since it never overflows horizontally.
Constructors
TwStepper()
public TwStepper()
Properties
ActiveStep
Gets the currently active step, or null if ActiveStepIndex is out of range (e.g. before any steps have registered).
public TwStep? ActiveStep { get; }
Property Value
ActiveStepIndex
Gets or sets the index (zero-based) of the currently active step.
[Parameter]
public int ActiveStepIndex { get; set; }
Property Value
ActiveStepIndexChanged
Gets or sets the callback invoked when the active step changes, enabling two-way binding via
@bind-ActiveStepIndex.
[Parameter]
public EventCallback<int> ActiveStepIndexChanged { get; set; }
Property Value
ChildContent
Gets or sets the TwStep children declaring each step.
[Parameter]
public required RenderFragment ChildContent { get; set; }
Property Value
Color
Gets or sets the accent color used for the active and completed step indicators and connectors.
[Parameter]
public Color? Color { get; set; }
Property Value
Remarks
If not set, uses the theme's default primary color.
IsFirstStep
Gets whether the active step is the first step.
public bool IsFirstStep { get; }
Property Value
IsLastStep
Gets whether the active step is the last step.
public bool IsLastStep { get; }
Property Value
Linear
Gets or sets whether steps must be completed in order.
[Parameter]
public bool Linear { get; set; }
Property Value
Remarks
When true (the default), clicking a step's indicator is only allowed for the active step or one before it - i.e. a step the user can already see is completed - preventing the user from skipping ahead of steps whose prerequisites haven't been completed. Set to false to let the user freely jump to any non-disabled step by clicking it. This only restricts user-initiated clicks - GoToStep(int) can always move programmatically to any non-disabled step regardless of this setting.
Orientation
Gets or sets the layout direction of the stepper.
[Parameter]
public StepperOrientation Orientation { get; set; }
Property Value
Methods
BuildRenderTree(RenderTreeBuilder)
Renders the component to the supplied RenderTreeBuilder.
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
__builderRenderTreeBuilder
GoToStep(int)
Moves directly to the step at index, if it exists, isn't disabled, and isn't
already active.
public Task GoToStep(int index)
Parameters
indexint
Returns
Remarks
Unlike clicking a step's indicator, this always succeeds for any in-range, non-disabled step, regardless of Linear - call this from your own "Next"/"Back" buttons, or after your own validation, rather than to bypass Linear on the user's behalf from a step click handler.
NextStep()
Advances to the next enabled step, if there is one.
public Task NextStep()
Returns
PreviousStep()
Moves back to the previous enabled step, if there is one.
public Task PreviousStep()