nercone.devaboutlinkscontactsitemap
aboutlinkssitemap82ffc6419

Progress

Linear, circular, and logo progress indicators.

A progress indicator shows how much of a task is done. Give it role="progressbar", a label, and the value in aria-valuenow, within aria-valuemin (default 0) and aria-valuemax (default 100). Without aria-valuenow, it is indeterminate and animates.

progress.js sets --progress-value (from 0 to 1) from these attributes, and updates it when they change. To draw the value without JavaScript, set --progress-value in a stylesheet as well.

Linear

<div class="progress-linear" role="progressbar" aria-label="Upload" aria-valuenow="40"></div>

Circular

<svg class="progress-circular" viewBox="0 0 48 48" role="progressbar" aria-label="Upload" aria-valuenow="40">
    <circle class="progress-track"     cx="24" cy="24" r="20" pathLength="1"/>
    <circle class="progress-indicator" cx="24" cy="24" r="20" pathLength="1"/>
</svg>

Logo

Draws the line of the Nercone logo, the same shape as the loading overlay.

<svg class="progress-logo" viewBox="0 0 78 48" role="progressbar" aria-label="Loading">
    <polyline class="progress-track"     points="72.75 29.6953125 5.25 7.125 5.25 40.875 39 40.875 72.75 7.125 72.75 40.875 55.171875 40.875" pathLength="1"/>
    <polyline class="progress-indicator" points="72.75 29.6953125 5.25 7.125 5.25 40.875 39 40.875 72.75 7.125 72.75 40.875 55.171875 40.875" pathLength="1"/>
</svg>

In the circular and logo indicators, progress-track is the background line and progress-indicator is the value. pathLength="1" is required, because the value is drawn with a dash of that length.

Range

aria-valuemin="0" aria-valuemax="5" aria-valuenow="3" is 60%.

Label

progress-label is a line above a linear indicator, with a name at the start and the value at the end.

Storage412 GiB / 1 TiB
<div>
    <span class="progress-label"><span>Storage</span><span>412 GiB / 1 TiB</span></span>
    <div class="progress-linear" role="progressbar" aria-label="Storage" aria-valuenow="40"></div>
</div>

Levels

For a value that should stay low, such as the usage of a disk, write the ratios (from 0 to 1) at which it becomes a warning and a caution in data-progress-thresholds, on the indicator or any ancestor. progress.js then sets data-progress-level to normal, warning, or caution, and the indicator is drawn in --color-progress-warning or --color-progress-caution. Gauges and heatmap cells follow the levels as well.

<div data-progress-thresholds="0.75 0.9">
    <div class="progress-linear" role="progressbar" aria-label="Disk" aria-valuenow="80"></div>
</div>

The color is not the only sign of the level: write the value in text as well.

Customization

Change the size with --progress-size (circular and logo, default 48px) and --progress-thickness (default 4px), the length of one cycle of the indeterminate animation with --progress-duration (default 1.5s, and 3s for the logo), and the colors with --color-progress and --color-progress-track.

.upload {
    --progress-size:      96px;
    --progress-thickness: 2px;
    --color-progress:     var(--color-success-bright);
}