GUILD OF GLEKS UIv21.14.0

gog-progressbar

Progress Bar

A horizontal progress indicator in three modes — determinate, indeterminate and buffer — five sizes and the library's semantic color set.

Overview

Import the component and drop it into a template.

typescript
import { ProgressbarComponent } from '@guildofgleks/ui';

@Component({
  // ...
  imports: [ProgressbarComponent],
})

Basic usage:

<gog-progressbar [value]="42" ariaLabel="Upload progress" />

Examples

Modes

determinate reflects value. indeterminate is work of unknown length. buffer draws a second, lighter level ahead of the fill — a streaming or preload position.

<gog-progressbar [value]="42" ariaLabel="Upload" />
<gog-progressbar mode="indeterminate" ariaLabel="Loading" />
<gog-progressbar mode="buffer" [value]="42" [buffer]="70" ariaLabel="Playback" />

Variants

accent is the default — progress is usually just "the app is working", which is not one of the four status hues.

This vocabulary is shared: since 21.9.0 it is exported as GogSeverity and GogProgressbarVariant is an alias of it, so the five names here are the same five gog-button's severity takes. Both spellings keep working.

@for (variantOption of variants; track variantOption) {
  <gog-progressbar [variant]="variantOption" [value]="65" [ariaLabel]="variantOption" />
}

Sizes

Five thickness steps, from a hairline to a chunky bar.

@for (sizeOption of sizes; track sizeOption) {
  <gog-progressbar [size]="sizeOption" [value]="65" [ariaLabel]="sizeOption" />
}

Showing the value, and clamping

showValue renders the rounded percentage beside the bar. Push the value past either end below: it is clamped to 0–100 rather than trusted, so a bar driven straight from loaded / total cannot break the layout when the last chunk overshoots.

42%
<gog-progressbar [value]="uploaded()" [showValue]="true" ariaLabel="Upload progress" />

Accessibility

The host carries role="progressbar" with aria-valuemin / aria-valuemax and, in determinate and buffer mode, aria-valuenow plus a readable aria-valuetext.

In indeterminate mode it reports noaria-valuenow at all — that omission is precisely what marks it indeterminate. Reporting 0 instead would announce "0 percent" forever. Its animation is also replaced by a static stripe under prefers-reduced-motion.

The fill's leading edge is marked by two hairlines, since 21.10.0. With showValue off — the default — that boundary is the only thing stating the value, and WCAG 1.4.11 asks 3:1 of the part of a graphic that carries its meaning. Fill against track could not carry it: 51 of the 55 shipped fill/track combinations were below 3:1, because the five fills straddle mid-luminance and no single track colour clears all of them in any theme but primeng. One marker tone does not work either, so there are two — the theme's ink outermost against the track, the surface colour just inside the fill — and whichever tone a fill sits close to, the other one reads. Worst case across the eleven themes is 3.25:1. The tones are --gog-progressbar-edge-color / -edge-backing-color, each --gog-progressbar-edge-width wide, and they flip end under dir="rtl".

Since 21.13.0 the buffer level ends with the same pair. Its boundary against the track was under 3:1 in every shipped theme and variant — 1.06:1 at worst — so in buffer mode you could not locate where the buffered region stopped. The same two tokens draw it, and nothing new needs overriding.

API Reference

Inputs

NameTypeDefaultDescription
valuenumber0Percentage complete, 0–100. Clamped rather than trusted — a bar driven from loaded / total overshoots on the last chunk often enough to be worth handling here. Ignored in indeterminate mode.
buffernumber0Secondary level shown behind value in buffer mode — preloaded but not yet played. Also clamped to 0–100.
mode'determinate' | 'indeterminate' | 'buffer''determinate'determinate reflects value; indeterminate is work of unknown length; buffer adds a second, lighter level ahead of the fill.
variant'accent' | 'success' | 'danger' | 'warning' | 'info''accent'Fill color. Wider than the tag palette by one: progress is usually just "the app is working", which is the accent color rather than any status hue.
size'xsm' | 'sm' | 'md' | 'lg' | 'slg''md'Bar thickness.
showValuebooleanfalseRenders the rounded percentage next to the bar. Off by default — most bars sit under a label that already says what is happening.
ariaLabelstring''Accessible name for the bar.

Global Configuration

This component has no GOG_CONFIG entries of its own — every default is set per instance. See Global Configuration for what does apply app-wide.

Styling Tokens

Every CSS custom property the progress bar paints with. Override any of them — on a single instance, a subtree, or a theme — to restyle it. See the Theming guide for the full token-layering model, or the Theme Generator to tweak these live.

TokenDescription
--gog-progressbar-accent-bg / -success-bg / -danger-bg / -warning-bg / -info-bgFill color per variant.
--gog-progressbar-{variant}-buffer-bgThe lighter buffer level shown ahead of the fill in "buffer" mode.
--gog-progressbar-track-base-bg / -radiusThe unfilled track.
--gog-progressbar-{size}-heightBar thickness, per size step (xsm/sm/md/lg/slg).
--gog-progressbar-indeterminate-duration / -indeterminate-easingIndeterminate animation timing. Replaced by a static stripe under prefers-reduced-motion.
--gog-progressbar-stripe-color / -stripe-sizeThe static stripe that stands in for the animation when motion is reduced.
--gog-progressbar-value-color / -value-font-size / -value-min-width / -value-gapThe percentage readout rendered when showValue is on.
--gog-progressbar-edge-color / -edge-backing-color / -edge-widthThe two hairlines marking where the fill ends, added in 21.10.0 — and, since 21.13.0, where the buffer level ends too. Two rather than one because no single tone clears WCAG 1.4.11 against all five fills: the ink line sits outermost against the track, the surface-coloured one just inside the fill, and whichever tone a fill sits close to, the other one reads. With showValue off — the default — this boundary is the only thing stating the value.