Data display
Progress
A progress bar with its percentage, for a task whose progress is known: an upload, an import, the steps of a form. The value comes from the server or follows an Alpine expression as it changes.
Nothing to show
A thin rounded gray track with a dark bar filling 40% of it, and "40%" under it. Screen readers announce a progress bar named "Import" at 40.
Updated by Livewire #
Each time $percent changes on the server, the bar slides to the new width and the percentage follows.
Nothing to show
Following an Alpine expression #
variable is a JavaScript expression evaluated in the surrounding Alpine scope, kept between 0 and 100. The bar and the percentage, here on the right of the bar, follow it as the data changes, without a server request.
Nothing to show
As an overlay #
Here file.progress stands for the upload progress of the image, 0 to 100. A square-ended bar along the bottom edge of the positioned parent, over its content, with no percentage text. top puts it at the top edge, and fill fills the parent from left to right behind its content.
Nothing to show
Colors by value #
A neutral bar below 80, amber from 80 and red from 100. The value is compared before it is cut to 100, so 120 is red with a full bar. With variable, the color follows the expression too.
Nothing to show
Colors #
color paints the bar; variant='accent' uses the theme accent.
Nothing to show
Sizes and square #
size sets the bar height and text size; square gives square ends.
Nothing to show
Percentage position #
position puts the percentage at bottom, top, left, right, or hides it with none.
Nothing to show
Overlay edges #
overlay lays a square bar over its positioned parent: top, bottom, or fill behind the content.
Nothing to show
Customization #
Classes go to the track; bar: reaches the filled bar and percent: the percentage text.
Nothing to show
Reference
tk:progress
| Prop | Type | Default | Description |
|---|---|---|---|
value |
int | float | 0 |
The percentage, from 0 to 100. |
variable |
string | null |
An Alpine expression for the percentage, followed as it changes. Takes the place of value. |
label |
string | false | Progress |
The accessible name, translated. false hides the bar from screen readers, for a decorative bar. |
position |
string | bottom |
Where the percentage goes: bottom, top, left, right, or none to hide it. |
color |
string | neutral | A color name for the bar (blue, green...). |
variant |
string | null |
accent paints the bar in the accent color. |
size |
string | md |
xs, sm, md, lg, xl, 2xl or 3xl. Sets the bar height and the text size. |
square |
bool | false |
Square ends instead of rounded ones. |
thresholds |
array | null |
limit => color: the bar takes the color of the highest limit the value reaches ([80 => 'amber', 100 => 'red']). Below the first limit it keeps color or variant. |
overlay |
string | null |
top, bottom or fill: lays the bar over its positioned parent, square, without text, and decorative unless a label is given. |
Prefixes
| Prefix | Goes to |
|---|---|
container: |
The element holding the track and the percentage. |
bar: |
The filled bar (bar:class="bg-green-500"). |
percent: |
The percentage text. |
Customization
Classes and attributes on the tag go to the track. To reach the other parts, prefix the attribute (listed in the Reference above).
Nothing to show
Accessibility
A role="progressbar" with aria-valuemin="0", aria-valuemax="100", aria-valuenow kept up to date and an aria-label. With label set to false (and in overlays without a label) it is hidden from screen readers, so describe the progress in text nearby when it matters.
Behavior notes
- The bar animates when it grows. With
variableit jumps when it goes back, so a restarted task does not slide backwards; avalueupdated by Livewire slides both ways. It does not animate at all when the user prefers reduced motion. - With
valuethe bar is plain HTML rendered by the server, with no Alpine component. - Values below 0 or above 100 are clamped, and the percentage is rounded:
:value="33.333"shows "33%". variableis evaluated on the bar, where TALLKit adds one name of its own,paint: an expression that uses apaintof yours reads TALLKit's instead.