StepProgressBuilder service builds ordered step progress (e.g. lead workflow, onboarding) for use in the UI. You define steps with completion callbacks; the builder evaluates them and returns a StepProgressData DTO suitable for components like status steps.
Overview
- Chainable API —
for(),step(),withoutAutoComplete(), thenbuild(). - Auto-completion — By default, the rightmost completed step and all steps to its left are marked completed, so you don’t encode dependencies between steps.
- Optional strict mode — Use
withoutAutoComplete()so only steps whose callback returned true are marked completed.
Basic usage
Defining steps
Adds a step. Parameters:
- label — Main label for the step.
- isComplete —
callable(mixed): bool; receives the context passed tofor(). - sublabel — Optional (e.g. “Phone/Email”).
- deadline — Optional
DateTimeInterfaceor string (e.g. for countdowns). - flag — Optional string (e.g. for badges or status).
id (index), label, completed, flag, sublabel, and deadline in the built output.
Auto-completion
By default, the builder finds the rightmost step whoseisComplete callback is true and marks that step and all steps to its left as completed. Steps after it stay incomplete. That way you only define “is this step done?” and the builder infers a linear progression.
To turn this off and mark only steps whose callback returned true as completed (no filling of prior steps), call withoutAutoComplete() before build():
Conditional steps
The builder uses Laravel’sConditionable trait, so you can use when() (and related methods) in the chain:
Output DTOs
- StepProgressData —
steps: array ofStepProgressStepData. - StepProgressStepData —
id,label,completed,flag,sublabel,deadline.
#[TypeScript]; use composer generate-ts (or your app’s script) to generate frontend types.
Frontend component
Use theStatusSteps component from Core to render the progress. It expects an array of steps matching StepProgressStepData (or your app’s equivalent). It shows a horizontal row of dots with labels, connector lines, and optional deadline countdowns; incomplete steps with a past deadline get a warning/error state.
Import and props: