Steps & wizard
Show where someone is in a process, and walk them through a long form one part at a time.
Steps
An <ol class="steps"> of .steps, each with a .step-marker (numbered for you) and a .step-label. Finished steps get .is-done (a check), the current one aria-current="step". On phones only the current label shows.
- Account
- Workspace
- Invite team
- Done
<ol class="steps">
<li class="step is-done"><span class="step-marker"></span><span class="step-label">Account</span></li>
<li class="step is-done"><span class="step-marker"></span><span class="step-label">Workspace</span></li>
<li class="step" aria-current="step"><span class="step-marker"></span><span class="step-label">Invite team</span></li>
<li class="step"><span class="step-marker"></span><span class="step-label">Done</span></li>
</ol>Vertical and small
.steps-vertical stacks them (with a second line in .step-sub); .steps-sm is smaller.
- Connect your bankDone on Oct 4
- Verify your identityTakes about 2 minutes
- Start sending money
<ol class="steps steps-vertical">
<li class="step is-done"><span class="step-marker"></span><span class="step-label">Connect your bank<span class="step-sub">Done on Oct 4</span></span></li>
<li class="step" aria-current="step"><span class="step-marker"></span><span class="step-label">Verify your identity<span class="step-sub">Takes about 2 minutes</span></span></li>
<li class="step"><span class="step-marker"></span><span class="step-label">Start sending money</span></li>
</ol>Wizard
Put data-momo-wizard on a form with .steps and one .wizard-panel per step. [data-momo-next] checks the panel's fields first, [data-momo-prev] goes back, and clicking a finished step jumps back to it. data-momo-show="not-first", "last" or "not-last" shows buttons only where they make sense.
<form class="card" data-momo-wizard id="demo-wizard" novalidate>
<div class="card-body">
<ol class="steps steps-sm">
<li class="step"><span class="step-marker"></span><span class="step-label">You</span></li>
<li class="step"><span class="step-marker"></span><span class="step-label">Workspace</span></li>
<li class="step"><span class="step-marker"></span><span class="step-label">Plan</span></li>
</ol>
<section class="wizard-panel">
<div class="form-field"><label class="form-label" for="wz-name">Your name</label><input class="form-control" id="wz-name" required autocomplete="name"></div>
<div class="form-field"><label class="form-label" for="wz-email">Work email</label><input class="form-control" id="wz-email" type="email" required autocomplete="email"></div>
</section>
<section class="wizard-panel" hidden>
<div class="form-field"><label class="form-label" for="wz-ws">Workspace name</label><input class="form-control" id="wz-ws" required placeholder="Momo Studio"></div>
<div class="form-field"><label class="form-label" for="wz-size">Team size</label>
<select class="form-select" id="wz-size" required><option value="" disabled selected>Choose a size</option><option>Just me</option><option>2 to 10</option><option>11 to 50</option><option>51+</option></select></div>
</section>
<section class="wizard-panel" hidden>
<div class="check-cards">
<label class="check check-card"><input type="radio" name="wz-plan" checked><span>Basic <small class="check-desc">$0 / month</small></span></label>
<label class="check check-card"><input type="radio" name="wz-plan"><span>Pro <small class="check-desc">$29 / month</small></span></label>
</div>
</section>
<div class="wizard-actions">
<button class="btn btn-ghost" type="button" data-momo-prev data-momo-show="not-first"><i class="mi mi-arrow-left"></i> Back</button>
<button class="btn btn-brand" type="button" data-momo-next data-momo-show="not-last">Next <i class="mi mi-arrow-right"></i></button>
<button class="btn btn-brand" type="submit" data-momo-finish data-momo-show="last"><i class="mi mi-check"></i> Create workspace</button>
</div>
</div>
</form>JavaScript
wizard.addEventListener('momo:step', (e) => console.log(e.detail.index, e.detail.total));
Momo.wizard.go(wizard, 0);