← All @molecule/* packages · App templates
@molecule/app-stepperCore interface · stepper · App (browser) · v1.0.1 · Apache-2.0
Stepper core interface for molecule.dev.
npm install @molecule/app-stepper@molecule/app-stepper is the stepper core interface on the app (browser) side: the API your app calls, with no vendor inside.
Choose the implementation by bonding one of its 1 provider: @molecule/app-stepper-default.
import { requireProvider, setProvider } from '@molecule/app-stepper'
import { provider } from '@molecule/app-stepper-default'
setProvider(provider) // once, at startup (bonds.ts)
const stepper = requireProvider().createStepper({
steps: [{ label: 'Account' }, { label: 'Profile' }, { label: 'Review' }],
onStepChange: (step) => rerender(step),
})
stepper.next()Providers (1): @molecule/app-stepper-default
Works with: @molecule/app-bond
Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
Stepper core interface for molecule.dev.
Provides a standardized API for multi-step wizard / stepper UI
components. Bond a provider (e.g. @molecule/app-stepper-default)
to supply the concrete implementation.
import { requireProvider, setProvider } from '@molecule/app-stepper'
import { provider } from '@molecule/app-stepper-default'
setProvider(provider) // once, at startup (bonds.ts)
const stepper = requireProvider().createStepper({
steps: [{ label: 'Account' }, { label: 'Profile' }, { label: 'Review' }],
onStepChange: (step) => rerender(step),
})
stepper.next()
core
npm install @molecule/app-stepper @molecule/app-bond
StepA single step in a stepper wizard.
interface Step {
/** Display label for the step. */
label: string
/** Optional description or help text. */
description?: string
/** Optional icon identifier. */
icon?: string
/** Whether this step can be skipped. Defaults to `false`. */
optional?: boolean
/** Error message to display on the step. */
error?: string
/** Whether this step has been completed. */
completed?: boolean
}
StepperInstanceA live stepper instance returned by the provider.
interface StepperInstance {
/**
* Advances to the next step.
*/
next(): void
/**
* Goes back to the previous step.
*/
previous(): void
/**
* Jumps to a specific step by index.
*
* @param step - Zero-based step index.
*/
goTo(step: number): void
/**
* Returns the index of the currently active step.
*
* @returns Zero-based index of the active step.
*/
getActiveStep(): number
/**
* Checks whether all steps have been completed.
*
* @returns `true` if every step is marked as completed.
*/
isComplete(): boolean
/**
* Validates the current step.
*
* @returns `true` if the current step passes validation.
*/
validate(): boolean
/**
* Destroys the stepper instance and cleans up resources.
*/
destroy(): void
}
StepperOptionsConfiguration options for creating a stepper.
interface StepperOptions {
/** Steps to display. */
steps: Step[]
/** Index of the initially active step. Defaults to `0`. */
activeStep?: number
/** Layout orientation. Defaults to `'horizontal'`. */
orientation?: 'horizontal' | 'vertical'
/** Callback when the active step changes. */
onStepChange?: (step: number) => void
/** Whether steps must be completed in order. Defaults to `false`. */
linear?: boolean
}
StepperProviderStepper provider interface.
All stepper providers must implement this interface to create and manage multi-step wizard UI.
interface StepperProvider {
/** Provider name identifier. */
readonly name: string
/**
* Creates a new stepper instance.
*
* @param options - Configuration for the stepper.
* @returns A stepper instance for managing navigation.
*/
createStepper(options: StepperOptions): StepperInstance
}
getProvider()Retrieves the bonded stepper provider, or null if none is bonded.
function getProvider(): StepperProvider | null
Returns: The active stepper provider, or null.
hasProvider()Checks whether a stepper provider has been bonded.
function hasProvider(): boolean
Returns: true if a stepper provider is available.
requireProvider()Retrieves the bonded stepper provider, throwing if none is configured.
function requireProvider(): StepperProvider
Returns: The active stepper provider.
setProvider(provider)Registers a stepper provider as the active singleton.
function setProvider(provider: StepperProvider): void
provider — The stepper provider implementation to bond.| Provider | Package |
|---|---|
| Stepper | @molecule/app-stepper-default |
Peer dependencies:
@molecule/app-bond ^1.0.1@molecule/app-bond
The instance is HEADLESS state, not UI. createStepper returns a step
state machine — nothing appears on screen. The app renders the step
indicator and content itself, re-rendering from onStepChange /
getActiveStep(); style via getClassMap() from @molecule/app-ui and
run every label through t('key', values, { defaultValue }).
Wire it with THIS package's setProvider() or bond('stepper', …).
setProvider() delegates into the shared @molecule/app-bond registry, so
both write the same slot; {@link requireProvider} throws until one has run.
Call destroy() when the owning screen unmounts.
Integration checklist — drive the real rendered wizard in the live preview (no mocks), adapt each item to this app's actual steps/screens, and check every box off one by one. A box you can't check is an integration bug to fix — not a skip:
steps
config and getActiveStep().optional,
by contrast, CAN be advanced past without completing it.linear stepper refuses to jump ahead — clicking an unreached
future step in the indicator (or goTo(futureIndex)) does nothing and the
active step stays put; you reach it only by completing the steps before
it. A non-linear stepper lets you navigate directly to any step.isComplete() is true — the
wizard doesn't advance past the end.