# KptLoader (kpt-loader)
A loader with character: a loop in one of six materials that, when the work ends, turns into a
result mark instead of disappearing. Import: `import { KptLoader } from '@konce-pt/angular';`
Use `kpt-spinner` for a small inline "wait" (in a button, next to a label). Use `kpt-loader` where
the waiting itself is the content - an empty panel, an upload, a save that ends in "Done".
## Variants
- `bubbles` (default) - four drops orbit, merge and splash; the result: one drop grows into the mark.
- `bridge` - a drop flies through a row of dots, joined to each by a liquid bridge; the result: a
pill with the mark and `successLabel` / `errorLabel` written in it.
- `shapes` - one shape morphs into the next (cookie, clover, pill, sun...) with a springy turn; the
result: a circle (success) or a rounded square (error).
- `ring` - a ring with a wave; draws progress; takes content (an icon) in its centre.
- `wave` - a progress bar drawn as a wave; draws progress; the result bends the line into the mark.
- `bounce` - three bubbles jump with squash and shadow; the result: a joint jump and a landing.
## Inputs
- `variant`: KptLoaderVariant (default 'bubbles')
- `status`: 'loading' | 'success' | 'error' (default 'loading') - `success` / `error` play the
result and the mark stays; going back to `loading` restarts the loop
- `value`: number | null (default null), `min` (0), `max` (100) - progress, read by `ring` and
`wave`; `null` = indeterminate
- `size`: string (default '5rem') - the CSS length of 100 drawing units; all variants share the
scale, so side by side their elements have the same size (`wave` is 12rem wide at the default)
- `colors`: KptLoaderColor[] | null - loop colours: theme roles ('primary', 'info', 'success',
'warning', 'danger') or any CSS colour; repeated in order. Without it each variant has its palette
- `successColor`: KptLoaderColor (default 'success'), `errorColor`: KptLoaderColor (default 'danger')
- `speed`: number (default 1) - multiplies the loop tempo (the result keeps its own timing)
- `label`: string - the accessible name while loading; default `loader.label`
- `successLabel`, `errorLabel`: string - the result text (status region, the `bridge` pill);
default `loader.success` / `loader.error`. They follow the language live, also after the result
- `announce`: boolean (default true) - `false` drops the component's own status region (for a
wrapper that announces the state itself, like `kpt-update`)
## Outputs
- `settled`: KptLoaderResult - the result choreography has finished (a good moment to hide the
loader). Not emitted when the loader starts already in a result.
## Content
Only `ring` renders projected content: centred, 64% of the ring's diameter. With content the
ring shrinks it during the loop and releases it on success; without content the ring closes and
draws the mark itself.
## Example
## Tokens
Roles resolve to `--kpt-color-`, the mark on a filled shape to `--kpt-color--contrast`
(a custom colour gets `--kpt-color-surface`), the `shapes` backdrop to `--kpt-color--subtle`.
Tracks use `--kpt-color-border`, the `bounce` shadows `--kpt-color-overlay-scrim`, the pill text
`--kpt-font-family-sans` and `--kpt-font-weight-semibold`. Colour transitions are multiplied by
`--kpt-motion-scale`.
## Motion
The drawing is SVG built by `createLoader` from `@konce-pt/motion` (shared with the React port) and
played in one `requestAnimationFrame` loop that stops when the loader is off-screen or settled.
`provideKptMotion({ enabled: false })` and the system "reduce motion" setting give the quiet
version: the loop slows down instead of stopping (a frozen loader looks like a hung app) and the
result is the mark in a circle, without choreography. A result that nobody watches (off-screen,
hidden tab) jumps straight to its final state.
## Accessibility
The drawing is `aria-hidden`. Next to it sits a visually hidden `.kpt-loader__label` with
`role="status"`; its text - `label`, then `successLabel` or `errorLabel` - is written a frame after
the loader appears, so screen readers announce it. While `ring` or `wave` draws progress, the stage
is a `role="progressbar"` with `aria-valuenow` (0-100) and the `label` as its name.