# API of `@koobiq/components/progress-bar`

Documented on [Progress bar](https://koobiq.io/en/components/progress-bar.md). NgModule: `KbqProgressBarModule`.

## Components

### KbqProgressBar (component)

Horizontal indicator of the progress of an operation.

```ts
@Component({ selector: 'kbq-progress-bar' })
class KbqProgressBar extends KbqColorDirective {
    readonly id = input<string>(`kbq-progress-bar-${idIterator++}`);
    readonly value = input<number>(0);
    readonly mode = input<ProgressBarMode>('determinate');
    readonly ariaLabel = input<string | null>(null, {
        alias: 'aria-label'
    });
    readonly color = input<T | null | undefined>();
    get colorClassName(): string;
    setDefaultColor(color: T): void;
}
```

- `[id]`: `string` — Id of the host element. Generated when not supplied.
- `[value]`: `number` — Share of the work that is done, in the `[0, 100]` range. Ignored in indeterminate mode.
- `[mode]`: `ProgressBarMode` — Whether the bar reports `value`, or an operation whose duration is unknown.
- `[aria-label]`: `string | null` — Accessible name of the bar. Takes precedence over a projected `[kbq-progress-bar-text]`; when
  neither is given, the bar falls back to the `progressBar` name from the a11y locale.
- `[color]`: `T | null | undefined` — Color of the component. A value set in code holds until the input changes, and the default color is used
  while both are unset or falsy.
- `colorClassName`: `string` — current class name of color
- `setDefaultColor()`: `void` — this color will be used as a default value. For example [color]="'' | false | undefined | null".

## Directives

### KbqProgressBarCaption (directive)

Caption projected below the bar. Describes the bar for assistive tech: `KbqProgressBar` points its
`aria-describedby` at this element.

```ts
@Directive({ selector: '[kbq-progress-bar-caption]' })
class KbqProgressBarCaption {
    readonly id = input<string>(
        `kbq-progress-bar-caption-${captionIdIterator++}`
    );
}
```

- `[id]`: `string` — Element id. Generated when not supplied, so the bar can always reference it.

### KbqProgressBarText (directive)

Label projected above the bar. Names the bar for assistive tech: `KbqProgressBar` points its
`aria-labelledby` at this element.

```ts
@Directive({ selector: '[kbq-progress-bar-text]' })
class KbqProgressBarText {
    readonly id = input<string>(
        `kbq-progress-bar-text-${textIdIterator++}`
    );
}
```

- `[id]`: `string` — Element id. Generated when not supplied, so the bar can always reference it.

## Types

### ProgressBarMode (type)

Whether the bar reports a known share of the work, or an operation whose duration is unknown.

```ts
type ProgressBarMode = 'determinate' | 'indeterminate';
```
