# KptProgress (kpt-progress)
A progress indicator - linear or circular, determinate (`min`-`max`) or indeterminate (`value` = null).
Import: `import { KptProgress } from '@konce-pt/angular';`
## DOM
Loading...
80%75%
The label, the track and the value are siblings straight under the host - there is no wrapper element.
`data-variant`, `data-type`, `data-size` and `data-label-position` all sit on the host, which is also
where the private `--_color` and `--_thickness` are resolved.
## Inputs
- `value`: number|null (default null) - a value on the `min`-`max` scale, or null for indeterminate
- `min`: number (default 0); `max`: number (default 100)
- `variant`: 'primary'|'success'|'danger'|'warning'|'info' (default 'primary')
- `type`: 'linear'|'circular' (default 'linear')
- `size`: 'sm'|'md'|'lg' (default 'md') - track thickness, and arc width on the circular variant
- `diameter`: number (default 40) - the circular variant's size in pixels
- `bufferValue`: number|null (default null) - a second, dimmed bar behind the main one; linear only
- `showValue`: boolean (default false) - turns the value area on; projected content needs it too
- `valueFormat`: 'percent'|'fraction'|'none' (default 'percent')
- `label`: string - descriptive text next to the bar; it also becomes the `aria-label`
- `labelPosition`: 'top'|'bottom'|'end' (default 'top') - ignored by the circular variant
## Value label
`showValue` opens the value area; `valueFormat` decides what goes in it - `percent` renders `80%`,
`fraction` renders `152 / 160` from `value` and `max`, `none` leaves it empty. Both strings come from
the `KptMessages` dictionary (`progress.percent`, `progress.fraction`), so a new locale can reshape them.
Projected content replaces the formatted value instead of adding to it, which is how a circle shows
a headline number over a caption. Projection still requires `showValue`, because that input is what
renders the element the content lands in.
The circular variant always centres the value over the arc; `label` is not drawn there, it only feeds
the accessible name.
## How the arc is drawn
The circle lives in a fixed `viewBox="0 0 40 40"` with `r=16`, so the circumference is computed from
that radius, not from `diameter` - the SVG scales, the maths does not change. The arc is the dash
offset: full circumference means empty, zero means complete. `size` only changes `stroke-width`, and
the widest step still fits inside the box, so no arc is ever clipped.
Values outside the range are clamped rather than rejected, `max` <= `min` collapses to zero, and the
buffer is never allowed behind the main bar - a computed percentage that briefly overshoots cannot
break the drawing.
## Examples
29
Excellent
## Tokens
The semantic colour of each variant (`--kpt-color-primary` / `-success` / `-danger` / `-warning` /
`-info`), plus the component layer: `--kpt-progress-track-bg`, `--kpt-progress-thickness-sm`,
`--kpt-progress-thickness-md`, `--kpt-progress-thickness-lg`, `--kpt-progress-buffer-opacity`,
`--kpt-progress-label-fg`, `--kpt-progress-value-fg`, `--kpt-progress-gap`.
## Accessibility
`role="progressbar"` with `aria-valuemin`, `aria-valuemax` and `aria-valuenow`; an indeterminate bar
leaves the value out, which is how a screen reader learns the progress is unknown rather than zero.
`valueFormat="fraction"` also sets `aria-valuetext`, so the reader says "152 / 160" instead of
announcing the raw number as a percentage. The visible value is `aria-hidden`, so it is never read
twice. The accessible name comes from `label`, or from the dictionary when there is none.
Under `prefers-reduced-motion: reduce` the indeterminate animation slows down instead of stopping -
a frozen progress indicator reads as a hung application.