Skip to content

ProgressBar

final class Phui\Components\ProgressBar

A bar filled to current / max, growing to the width available to it, with an optional percentage on the right. The fraction is clamped to 0–1, and a max of zero or less reads as 0%. Takes no focus and emits nothing.

A progress bar filled to 64 percent

php
use Phui\Components\ProgressBar;

ProgressBar::mount()->props(current: $this->done, max: $this->total);

Props

PropTypeDefaultDescription
currentint0How much of max is complete.
maxint100The value that counts as full.
showPercentbooltrueWhether to render the percentage after the bar.
prefixstring''Text before the bar.
postfixstring'%'Suffix on the percentage.
filledCharstring'━'Repeated across the filled part.
emptyCharstring'─'Repeated across the remainder.

Colours

Phui\Components\Colours\ProgressBarColours

ColourPalette defaultUsed for
fillaccentThe filled part of the bar.
emptysurfaceThe remainder of the bar.

Released under the MIT License.