VDT.Core.Blazor.Wizard
2.0.2
See the version list below for details.
dotnet add package VDT.Core.Blazor.Wizard --version 2.0.2
NuGet\Install-Package VDT.Core.Blazor.Wizard -Version 2.0.2
<PackageReference Include="VDT.Core.Blazor.Wizard" Version="2.0.2" />
paket add VDT.Core.Blazor.Wizard --version 2.0.2
#r "nuget: VDT.Core.Blazor.Wizard, 2.0.2"
// Install VDT.Core.Blazor.Wizard as a Cake Addin #addin nuget:?package=VDT.Core.Blazor.Wizard&version=2.0.2 // Install VDT.Core.Blazor.Wizard as a Cake Tool #tool nuget:?package=VDT.Core.Blazor.Wizard&version=2.0.2
VDT.Core.Blazor.Wizard
Blazor component that helps you create wizard components with sequential steps, forward/back navigation, conditional completion of steps, step- and wizard-level events, and more
Features
- Fully customizable layout
- Events for starting, stopping and completing the wizard
- Steps completed only on your own conditions
- Events for initializing and attempted competion of steps
- Optional back navigation and cancelling
Styling
The wizard can be provided with the following CSS classes:
ContainerClass
gets applied to adiv
surrounding the entire wizard when using the default layoutTitleContainerClass
gets applied to adiv
surrounding the title content when using the default layoutStepTitleContainerClass
gets applied to adiv
surrounding the step titles when using the default layoutStepTitleClass
gets applied to the step titlediv
sActiveStepTitleClass
gets applied to the active step titlediv
ButtonContainerClass
gets applied to adiv
surrounding the navigation buttons when using the default layoutButtonClass
gets applied to all navigation buttonsButtonCancelClass
gets applied to the cancel buttonButtonPreviousClass
gets applied to the previous buttonButtonNextClass
gets applied to the next buttonButtonFinishClass
gets applied to the finish buttonContentContainerClass
gets applied to adiv
surrounding the content of the currently active step when using the default layout
Example
<div>
<button @onclick="async () => await Wizard.Start()" class="btn btn-primary">Start wizard</button>
<button @onclick="() => Wizard.Stop()" class="btn btn-secondary">Stop wizard</button>
</div>
<Wizard @ref="Wizard"
OnStart="Start"
OnStop="Stop"
OnFinish="Finish"
ContainerClass="wizard"
TitleContainerClass="wizard-title"
StepTitleContainerClass="wizard-steps"
StepTitleClass="wizard-step"
ActiveStepTitleClass="active"
AllowCancel="true"
AllowPrevious="true"
ButtonContainerClass="wizard-buttons"
ButtonClass="wizard-button"
ButtonCancelClass="wizard-button-secondary"
ButtonCancelText="Stop"
ButtonPreviousClass="wizard-button-secondary"
ButtonPreviousText="<< Prev"
ButtonFinishClass="wizard-button-primary"
ButtonFinishText="Complete"
ButtonNextClass="wizard-button-primary"
ButtonNextText="Next >>"
ContentContainerClass="wizard-body">
<TitleContent>
<h3>Wizard title</h3>
</TitleContent>
<Steps>
<WizardStep OnInitialize="args => InitializeStep(args, 1)" OnTryComplete="args => TryCompleteStep(args, 1)" Title="The first step">
Test step 1
</WizardStep>
<WizardStep OnInitialize="args => InitializeStep(args, 2)" OnTryComplete="args => TryCompleteStep(args, 2)" Title="Another">
<div class="form-check">
<input id="goNext" type="checkbox" @bind="GoNext" class="form-check-input" />
<label for="goNext" class="form-check-label">Go next?</label>
</div>
<div>
Test step 2
</div>
</WizardStep>
<WizardStep OnInitialize="args => InitializeStep(args, 3)" OnTryComplete="args => TryCompleteStep(args, 3)" Title="Summary">
Test step 3
</WizardStep>
</Steps>
</Wizard>
<pre>
@StepData
</pre>
@code {
public Wizard Wizard { get; set; }
public bool GoNext { get; set; } = true;
public string StepData = string.Empty;
public void Start(WizardStartedEventArgs args) {
StepData += $"{nameof(Start)} wizard{Environment.NewLine}";
}
public void Stop(WizardStoppedEventArgs args) {
StepData += $"{nameof(Stop)} wizard{Environment.NewLine}";
}
public void Finish(WizardFinishedEventArgs args) {
StepData += $"{nameof(Finish)} wizard{Environment.NewLine}";
}
public void InitializeStep(WizardStepInitializedEventArgs args, int step) {
StepData += $"{nameof(InitializeStep)} step {step}{Environment.NewLine}";
GoNext = true;
}
public void TryCompleteStep(WizardStepAttemptedCompleteEventArgs args, int step) {
StepData += $"{nameof(TryCompleteStep)} step {step}{Environment.NewLine}";
args.IsCancelled = !GoNext;
}
}
Layout
A default layout is provided without any styling, but it's easy to supply your own layout using the layout context of a wizard. This gives you fine-grained control over which elements you want to render and which markup to use around them.
Available layout elements
DefaultLayout
renders the full default layoutTitle
renders theRenderFragment
TitleContent
StepTitles
renders the titles of all stepsButtons
renders all buttons as enabled and needed in the following order:- Cancel
- Previous
- Next / Finish
ButtonCancel
renders the cancel button only if enabledButtonPrevious
renders the previous button only if enabled and a previous step is availableButtonNext
renders the next button if a next step is availableButtonFinish
renders the finish button if no next step is availableContent
renders the content of the currently active step
Example
<Wizard ButtonClass="wizard-button" ButtonPreviousClass="wizard-button-secondary" ButtonPreviousText="<< Prev" ButtonFinishClass="wizard-button-primary" ButtonFinishText="Complete" ButtonNextClass="wizard-button-primary" ButtonNextText="Next >>"> <Layout> <div class="wizard"> <div class="wizard-title"> <h1>My wizard</h1> </div>
<div class="wizard-body">
@context.Content
</div>
<div class="wizard-buttons">
@context.ButtonNext
@context.ButtonFinish
</div>
</div>
</Layout>
<Steps>
<WizardStep Title="The first step">
Test step 1
</WizardStep>
<WizardStep Title="Another">
Test step 2
</WizardStep>
<WizardStep Title="Summary">
Test step 3
</WizardStep>
</Steps>
</Wizard>
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Microsoft.AspNetCore.Components.Web (>= 6.0.14)
-
net7.0
- Microsoft.AspNetCore.Components.Web (>= 7.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
- Fix bug where the full wizard wasn't shown on start