Subsection Flow
A flow that lives inline inside a page — no modal, no overlay. Useful for multi-step forms, inline confirmations, or collapsible wizards embedded in a larger UI.
Click Begin Checkout below to start the flow directly on this page.
Result
Loading...
Live Editor
How it works
- The
IdleContentcomponent is passed as children of<SequentOutlet />— it renders as idle content until a flow is active. IdleContentcallsuseSequentContext()to check if a previous flow completed — if so, the button reads "Begin Checkout Again".- Clicking the button calls
init(() => StepAddress), which replaces the idle children withStepAddressinside the outlet. - Each step calls
advance(NextStep)to move forward orretreat()to go back. StepReviewcallsresolve(value)—useSequentFlow().resultcaptures the resolved value, the outlet returns to idle, and theIdleContentreappears with the updated button label.- The outlet's
transitionrender prop crossfades between steps — the outgoing step animates out while the incoming step animates in.
Key points
- Idle children — the outlet renders its children when no flow is active. Idle children have access to
useSequentContext, which returns the last consumer context from the previous flow (orundefinedon first render). - No central state — each step decides what comes next via
advance(NextStep). - History is automatic —
retreat()pops the history stack with no manual bookkeeping. - Animated transitions —
crossfade()fromreact-sequent/transitionscrossfades between steps, wiringonAnimationEndto the outlet's exit completion signal. - The outlet is reusable — the same
useSequentFlow()host can start a fresh flow with anotherinit()call.