Skip to main content

Progress

Progress widgetProgress widget

A place to do work inside the form: select the row, press Enter, and its work runs with a determinate bar (when it declares a step count) or an indeterminate spinner (when it does not), drawn in the row itself as the work advances. It collects no value - it sits beside the fields it depends on, not among the answers.

$p->progress('pack', 'Packing the box')
->steps(6) // Omit for an indeterminate spinner.
->run(function (ProgressReporter $reporter) use ($items): void {
foreach ($items as $item) {
// ... one step of work ...
$reporter->advance(); // Fills one step of the bar (ticks the spinner).
}
});

Runnable script: playground/02-widgets-progress.php.

Options

MethodEffect
->steps(int)The step count, making the indicator a determinate bar. Omit it for an indeterminate spinner.
->run(callable)The work run when the row is activated. The callback receives a ProgressReporter and calls advance() once per step.

The indicator is drawn by the active theme, in its accent and Unicode/ASCII mode - the same spinner and bar as the standalone progress() primitive.

Keyboard

KeyAction
EnterRun the row's work
EscLeave the panel

Headless behaviour

A progress row is display-only: it carries no answer, is absent from the machine schema, and an unattended run skips it.

Display modes

In all four display modes - Unicode or ASCII, colour on or off:

ANSINo ANSI
UnicodeProgress: Unicode + ANSIProgress: Unicode + ANSIProgress: Unicode + No ANSIProgress: Unicode + No ANSI
ASCIIProgress: ASCII + ANSIProgress: ASCII + ANSIProgress: ASCII + No ANSIProgress: ASCII + No ANSI