0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…
Multi-step form patterns with numbered steps, tab navigation, and progress bar indicators. Guide users through complex forms with clear progress feedback.
Overview
Wizard patterns break complex forms into manageable steps, reducing cognitive load and improving completion rates. VB includes wizard.js, a production-ready controller that transforms standard HTML forms into multi-step wizards with progressive enhancement — forms still work without JavaScript.
Key features:
wizard.js controller — auto-initializes on form[data-wizard], handles step navigation, validation, and progress
nav.steps integration — auto-syncs step indicator state; auto-populates from legends when empty
Conditional steps (data-wizard-if) — show/hide steps based on user input, with AND/OR compound expressions
Optional steps (data-wizard-optional) — skip without validation
Summary/review step (data-wizard-summary) — auto-populate a review step with field values
Auto-injected navigation — Back/Next/Submit buttons created automatically when nav is omitted
Programmatic API — wizardNext(), wizardPrev(), wizardGoTo(), wizardReset()
Accessibility — aria-current="step", live regions, roving tabindex keyboard navigation
Numbered Steps
A horizontal step indicator with numbered circles connected by lines. Completed steps show checkmarks and can be clicked to navigate back. The current step is highlighted with the interactive color.
<bodydata-layout="cover"data-layout-min="xl"data-layout-padding="l"><layout-carddata-max="narrow"data-padding="l"data-layout-principal><layout-stackdata-layout-gap="xl"><h1>Create your account</h1><!-- Numbered step list, filled from the legends and kept in sync by wizard.js --><navclass="steps"id="signup-steps"aria-label="Sign-up progress"><ol></ol></nav><formaction="/signup"method="POST"data-wizarddata-wizard-steps="#signup-steps"><fieldsetdata-wizard-step><legend>Account</legend><form-field><labelfor="email">Email</label><inputtype="email"id="email"name="email"requiredautocomplete="email"/></form-field></fieldset><fieldsetdata-wizard-step><legend>Details</legend><layout-stackdata-layout-gap="l"><form-field><labelfor="full-name">Full name</label><inputtype="text"id="full-name"name="full_name"requiredautocomplete="name"/></form-field><form-field><labelfor="plan">Plan</label><selectid="plan"name="plan"><optionvalue="free">Free</option><optionvalue="pro">Pro ($12/month)</option></select></form-field></layout-stack></fieldset><fieldsetdata-wizard-stepdata-wizard-summary><legend>Review</legend></fieldset><navdata-wizard-navdata-layout="cluster"data-layout-justify="between"aria-label="Sign-up steps"><buttontype="button"class="secondary"data-wizard-prev>Back</button><buttontype="button"data-wizard-next>Next</button><buttontype="submit">Create account</button></nav></form></layout-stack></layout-card></body>
Step Indicator
The step indicator uses nav.steps from VB core — no custom CSS needed. See the Steps pattern for all variants and CSS variables.
No custom CSS required
/* No custom CSS needed — nav.steps is included in VB core. See the Steps pattern page for all variants and CSS variables. */
Tab Navigation
A tab-style step list where each step is represented as a tab. The tab look is bespoke (one .wizard-tabs class, styles below), but the behaviour is all wizard.js: data-wizard-steps points it at the list, and it marks each <li> with data-completed, aria-current="step" or aria-disabled="true". Completed tabs can be clicked (or reached with the arrow keys) to jump back; future tabs stay disabled until their prerequisites are met.
<bodydata-layout="cover"data-layout-min="xl"data-layout-padding="l"><layout-carddata-padding="none"data-layout-principal><formaction="/onboarding"method="POST"data-wizarddata-wizard-steps="#onboarding-tabs"><!-- Tab-style step list, synced by wizard.js --><navclass="wizard-tabs"id="onboarding-tabs"aria-label="Onboarding steps"><ol><li>Account</li><li>Profile</li><li>Preferences</li><li>Confirm</li></ol></nav><fieldsetdata-wizard-stepdata-variant="minimal"><legend>Create your account</legend><layout-stackdata-layout-gap="l"><form-field><labelfor="email">Email</label><inputtype="email"id="email"name="email"requiredautocomplete="email"placeholder="[email protected]"/></form-field><form-field><labelfor="password">Password</label><inputtype="password"id="password"name="password"requiredminlength="8"autocomplete="new-password"/></form-field></layout-stack></fieldset><fieldsetdata-wizard-stepdata-variant="minimal"><legend>Tell us about yourself</legend><layout-stackdata-layout-gap="l"><form-field><labelfor="full-name">Full name</label><inputtype="text"id="full-name"name="full_name"requiredautocomplete="name"placeholder="Jane Doe"/></form-field><form-field><labelfor="company">Company</label><inputtype="text"id="company"name="company"autocomplete="organization"placeholder="Acme Inc."/></form-field></layout-stack></fieldset><fieldsetdata-wizard-stepdata-variant="minimal"><legend>Set your preferences</legend><layout-stackdata-layout-gap="l"><form-field><labelfor="timezone">Timezone</label><selectid="timezone"name="timezone"required><optionvalue="">Select timezone...</option><optionvalue="pst">Pacific Time (PT)</option><optionvalue="mst">Mountain Time (MT)</option><optionvalue="cst">Central Time (CT)</option><optionvalue="est"selected>Eastern Time (ET)</option><optionvalue="utc">UTC</option></select></form-field><fieldsetdata-layout="stack"data-layout-gap="s"><legend>Notifications</legend><label><inputtype="checkbox"name="email_notifications"value="Product updates"checked/> Email notifications for updates</label><label><inputtype="checkbox"name="weekly_digest"value="Weekly digest"checked/> Weekly activity digest</label></fieldset><fieldsetdata-layout="cluster"data-layout-gap="l"><legend>Theme preference</legend><label><inputtype="radio"name="theme"value="light"/> Light</label><label><inputtype="radio"name="theme"value="dark"/> Dark</label><label><inputtype="radio"name="theme"value="system"checked/> System</label></fieldset></layout-stack></fieldset><fieldsetdata-wizard-stepdata-wizard-summarydata-variant="minimal"><legend>Confirm your details</legend><layout-stackdata-layout-gap="l"><p>Check your answers, then finish setting up your account.</p></layout-stack></fieldset><navdata-wizard-navaria-label="Step navigation"><buttontype="button"class="secondary"data-wizard-prev>Back</button><buttontype="button"data-wizard-next>Continue</button><buttontype="submit">Finish</button></nav></form></layout-card></body>
Tab Navigation Styles
Tab wizard styles
/* Tab-style step list. wizard.js sets [data-completed], [aria-current="step"] and [aria-disabled="true"] on each <li>. */.wizard-tabsol {display: flex;list-style: none;padding: 0;margin: 0;counter-reset: wizard-tab;border-block-end: var(--border-width-thin) solid var(--color-border);}.wizard-tabsli {counter-increment: wizard-tab;flex: 1;display: flex;align-items: center;justify-content: center;gap: var(--size-xs);margin: 00 -1px;padding: var(--size-m) var(--size-l);border-block-end: 3px solid transparent;color: var(--color-text-muted);font-size: var(--font-size-s);font-weight: 500;}.wizard-tabsli::before {content: counter(wizard-tab);display: inline-grid;place-items: center;inline-size: 1.5rem;block-size: 1.5rem;border-radius: 50%;background: var(--color-surface-raised);border: 1px solid var(--color-border);font-size: var(--font-size-xs);font-weight: 600;}/* Current step */.wizard-tabsli[aria-current="step"] {color: var(--color-interactive);border-block-end-color: var(--color-interactive);}.wizard-tabsli[aria-current="step"]::before {background: var(--color-interactive);border-color: var(--color-interactive);color: var(--color-text-on-primary);}/* Completed step: a check, and clickable to go back */.wizard-tabsli[data-completed] {color: var(--color-text);cursor: pointer;}.wizard-tabsli[data-completed]:hover {background: var(--color-surface-raised);}.wizard-tabsli[data-completed]::before {content: "\2713";background: var(--color-success);border-color: var(--color-success);color: white;}/* Future step */.wizard-tabsli[aria-disabled="true"] {opacity: 0.6;}/* The tabs already say which step is current */form:has(> .wizard-tabs)::before {display: none;}/* Inset the steps and buttons; the tabs run edge to edge */.wizard-tabs ~ :is(fieldset, nav) {margin-inline: var(--size-l);}.wizard-tabs ~ fieldset {padding-block-start: var(--size-m);}.wizard-tabs ~ fieldset > legend {font-size: var(--font-size-xl);font-weight: 600;}form:has(> .wizard-tabs) {padding-block-end: var(--size-l);}
Progress Bar
A native <progress data-wizard-progress> bar with a <progress-tracker> of step dots below it, both driven by wizard.js. Great for checkout flows and linear processes.
<bodydata-layout="cover"data-layout-min="xl"data-layout-padding="l"><layout-carddata-max="narrow"data-padding="l"data-layout-principal><layout-stackdata-layout-gap="xl"><headerdata-layout="stack"data-layout-gap="xs"><h1>Checkout</h1><p>Four quick steps. Your payment details are encrypted.</p></header><formaction="/checkout"method="POST"data-wizarddata-wizard-steps="#checkout-steps"><!-- Progress bar: wizard.js sets value/max on every step change --><labelfor="checkout-progress">Checkout progress</label><progressid="checkout-progress"data-wizard-progressmax="4"value="1"></progress><!-- Step dots, synced by wizard.js through data-wizard-steps --><progress-trackerid="checkout-steps"data-clickabledata-label-list="Checkout steps"><ol><lidata-step="cart">Cart</li><lidata-step="payment">Payment</li><lidata-step="shipping">Shipping</li><lidata-step="confirm">Confirm</li></ol></progress-tracker><fieldsetdata-wizard-step><legend>Your cart</legend><dldata-variant="horizontal"><div><dt>Premium Wireless Headphones</dt><dd>$249.00</dd></div><div><dt>USB-C Charging Cable × 2</dt><dd>$29.98</dd></div></dl></fieldset><fieldsetdata-wizard-step><legend>Payment details</legend><layout-stackdata-layout-gap="l"><form-field><labelfor="card-name">Name on card</label><inputtype="text"id="card-name"name="card_name"requiredautocomplete="cc-name"placeholder="John Doe"aria-describedby="card-name-error"/><outputid="card-name-error"class="error"for="card-name"aria-live="polite"> Please enter the name on your card.</output></form-field><form-field><labelfor="card-number">Card number</label><inputtype="text"id="card-number"name="card_number"requiredautocomplete="cc-number"placeholder="1234 5678 9012 3456"inputmode="numeric"pattern="[0-9\s]{13,19}"aria-describedby="card-number-error"/><outputid="card-number-error"class="error"for="card-number"aria-live="polite"> Please enter a valid card number.</output></form-field><layout-griddata-layout-min="xs"data-layout-gap="m"><form-field><labelfor="expiry">Expiry date</label><inputtype="text"id="expiry"name="expiry"requiredautocomplete="cc-exp"placeholder="MM/YY"inputmode="numeric"pattern="[0-9]{2}/[0-9]{2}"aria-describedby="expiry-error"/><outputid="expiry-error"class="error"for="expiry"aria-live="polite"> Enter MM/YY format.</output></form-field><form-field><labelfor="cvc">Security code</label><inputtype="text"id="cvc"name="cvc"requiredautocomplete="cc-csc"placeholder="123"inputmode="numeric"pattern="[0-9]{3,4}"aria-describedby="cvc-error"/><outputid="cvc-error"class="error"for="cvc"aria-live="polite"> 3 or 4 digits.</output></form-field></layout-grid></layout-stack></fieldset><fieldsetdata-wizard-step><legend>Shipping address</legend><layout-stackdata-layout-gap="l"><form-field><labelfor="address">Street address</label><inputtype="text"id="address"name="address"requiredautocomplete="address-line1"placeholder="123 Main St"/></form-field><layout-griddata-layout-min="xs"data-layout-gap="m"><form-field><labelfor="city">City</label><inputtype="text"id="city"name="city"requiredautocomplete="address-level2"placeholder="San Francisco"/></form-field><form-field><labelfor="zip">ZIP code</label><inputtype="text"id="zip"name="zip"requiredautocomplete="postal-code"placeholder="94102"/></form-field></layout-grid></layout-stack></fieldset><fieldsetdata-wizard-stepdata-wizard-summary><legend>Confirm your order</legend><p>Check the details below, then place your order.</p></fieldset><navdata-wizard-nav><buttontype="button"class="secondary"data-wizard-prev><icon-wcname="arrow-left"size="sm"></icon-wc> Back</button><buttontype="button"data-wizard-next> Continue<icon-wcname="arrow-right"size="sm"></icon-wc></button><buttontype="submit">Place order</button></nav></form></layout-stack></layout-card></body>
Progress Bar Styles
Nothing to add. Inside form[data-wizard] the <progress data-wizard-progress> is styled by VB core and wizard.js updates its value and max. The <progress-tracker> named by data-wizard-steps draws the step dots and follows the current step; with data-clickable, completed steps take the user back. wizard.js also prints a "Step N of M" line above the form.
No custom CSS required
/* No custom CSS needed: form[data-wizard] [data-wizard-progress] and <progress-tracker> are both styled by VB. */
wizard.js Controller
VB includes wizard.js, a lightweight controller that enhances form[data-wizard] elements with step navigation, validation, conditional steps, and progress tracking. It works as a standard form without JavaScript (progressive enhancement).
Basic Setup
Add data-wizard to a form. Each <fieldset data-wizard-step> becomes a step. The controller auto-initializes on DOMContentLoaded.
Basic wizard form
<formdata-wizard><progressdata-wizard-progressmax="3"value="1"></progress><fieldsetdata-wizard-step><legend>Personal Information</legend><!-- form fields --></fieldset><fieldsetdata-wizard-step><legend>Account Details</legend><!-- form fields --></fieldset><fieldsetdata-wizard-step><legend>Confirmation</legend><!-- form fields --></fieldset><navdata-wizard-nav><buttontype="button"data-wizard-prev>Previous</button><buttontype="button"data-wizard-next>Next</button><buttontype="submit">Submit</button></nav></form>
Conditional Steps
Use data-wizard-if to show a step only when a form field matches a value. The step is hidden when the condition is not met and the progress bar adjusts automatically.
Conditional step
<formdata-wizard><fieldsetdata-wizard-step><legend>Account Type</legend><label><inputtype="radio"name="accountType"value="personal"checked> Personal Account</label><label><inputtype="radio"name="accountType"value="business"> Business Account</label></fieldset><!-- Only shown when "business" is selected --><fieldsetdata-wizard-stepdata-wizard-if="accountType:business"><legend>Business Information</legend><form-field><labelfor="company">Company Name</label><inputtype="text"id="company"name="company"required></form-field></fieldset><fieldsetdata-wizard-step><legend>Contact Information</legend><!-- always shown --></fieldset><navdata-wizard-nav><buttontype="button"data-wizard-prev>Previous</button><buttontype="button"data-wizard-next>Next</button><buttontype="submit">Submit</button></nav></form>
Optional Steps
Use data-wizard-optional to mark a step that can be skipped. The "Next" button advances without requiring validation on optional steps.
Optional step
<formdata-wizard><fieldsetdata-wizard-step><legend>Required Info</legend><form-field><labelfor="name">Name</label><inputtype="text"id="name"name="name"required></form-field></fieldset><!-- Can be skipped without validation --><fieldsetdata-wizard-stepdata-wizard-optional><legend>Additional Details (Optional)</legend><form-field><labelfor="bio">Bio</label><textareaid="bio"name="bio"rows="3"></textarea></form-field></fieldset><fieldsetdata-wizard-step><legend>Done</legend><p>Click Submit to finish.</p></fieldset><navdata-wizard-nav><buttontype="button"data-wizard-prev>Previous</button><buttontype="button"data-wizard-next>Next</button><buttontype="submit">Submit</button></nav></form>
nav.steps Integration
When a nav.steps element is found inside the form (or referenced via data-wizard-steps="#id"), wizard.js automatically syncs step states — setting data-completed on past steps, aria-current="step" on the current step, and hiding <li> elements for conditional steps that don't apply.
If no data-wizard-field elements are present, a <dl> is auto-generated from all non-empty fields across visible steps. Labels are detected from <label> associations.
Auto-generated summary
<fieldsetdata-wizard-stepdata-wizard-summary><legend>Review</legend><!-- dl auto-generated from all form values --></fieldset>
Auto-Injected Navigation
If no [data-wizard-nav] element exists in the form, the wizard automatically injects a Back / Next / Submit navigation bar. This allows minimal wizard markup:
Minimal wizard — nav auto-injected
<formdata-wizard><fieldsetdata-wizard-step><legend>Step 1</legend>...</fieldset><fieldsetdata-wizard-step><legend>Step 2</legend>...</fieldset><!-- nav injected automatically --></form>
Auto-Populated Step List
When a nav.steps element contains an empty <ol>, the wizard auto-populates <li> items from each step's <legend> text. This eliminates the need to duplicate step names between fieldset legends and the navigation list.
Auto-populated step list
<formdata-wizard><navclass="steps"aria-label="Progress"><ol><!-- auto-populated from legends --></ol></nav><fieldsetdata-wizard-step><legend>Account</legend>...</fieldset><fieldsetdata-wizard-step><legend>Profile</legend>...</fieldset><fieldsetdata-wizard-step><legend>Confirm</legend>...</fieldset></form>
Keyboard Navigation
The step indicator (nav.steps) uses the roving tabindex pattern for keyboard access:
Arrow Right / Arrow Down — move focus to next step item
Arrow Left / Arrow Up — move focus to previous step item
Home — move focus to first step item
End — move focus to last step item
Enter / Space — activate completed step items to navigate back
Only the current step item is in the tab order (tabindex="0"). All other items have tabindex="-1" and are reachable only via arrow keys.
API & Events
Access the wizard programmatically via methods attached to the form element:
Programmatic API
// Get the formconst form = document.querySelector('#my-wizard');// Navigation methodsform.wizardNext(); // Go to next step (validates first)form.wizardPrev(); // Go to previous stepform.wizardGoTo(2); // Jump to step index 2 (zero-based)form.wizardReset(); // Reset to first step// Access the controllerconst ctrl = form.wizardController;console.log(ctrl.currentStep); // Current step indexconsole.log(ctrl.totalSteps); // Total visible steps// Listen for eventsform.addEventListener('wizard:step-change', (e) => {console.log(`Moved from step ${e.detail.from} to ${e.detail.to}`);});form.addEventListener('wizard:complete', () => {console.log('Wizard completed!');});
Custom Events
Event
Detail
Fires when
wizard:step-change
{ from, to }
User navigates to a different step
wizard:complete
none
Form is submitted on the last step
wizard:reset
none
Wizard is reset to the first step
Configuration
Key configuration options for wizard patterns:
Property
Purpose
Values
data-size="sm|lg"
Size of step indicator circles
sm (1.5rem), default (2rem), lg (2.5rem)
data-labels="below"
Position labels below circles
On nav.steps
<progress data-wizard-progress>
Progress bar inside form[data-wizard]
wizard.js sets value and max; pair it with a <label for>
data-wizard-steps="#id"
Step list for wizard.js to sync
A nav.steps, a <progress-tracker> or any <ol> list (e.g. the tab list)
aria-current="step"
Marks current step for screen readers
Apply to active step element
Usage Notes
Step Validation
Validate each step before allowing progression to the next
Show inline validation errors using <output class="error">
Disable the "Next" button until required fields are valid
Consider allowing users to skip optional steps
Saving Progress
Auto-save form data to prevent loss on accidental navigation
Use sessionStorage or server-side persistence
Show a "saved" indicator when data is preserved
Allow users to resume incomplete forms
Accessibility
Use aria-current="step" on the active step for screen readers
Use a native <progress> with a <label>; it carries the progressbar role and value without extra ARIA
Completed steps should have descriptive aria-label (e.g., "Go back to Account step (completed)")
Announce step changes to screen readers with live regions
Use aria-disabled="true" on future steps that cannot be accessed
Ensure keyboard navigation works for clickable completed steps
Navigation Best Practices
Always allow users to go back to previous steps
Preserve form data when navigating between steps
Disable future steps until prerequisites are complete
Show a summary/review step before final submission