# components/Progress (zidane-ui)

Import: `import { … } from 'zidane-ui'`. Source: [ui/src/components/Progress.tsx](https://github.com/Tahul/zidane/blob/main/ui/src/components/Progress.tsx).

## Components

### `Progress`

Component.

Renders the count, its line and the bar.

```ts
function Progress(props: ProgressProps): Element
```

**Parameters**

- `props` (`ProgressProps`): [`ProgressProps`](https://zidane.si/docs/reference/ui-components-progress.md#ProgressProps).

**Returns** `Element`

**Props**

- `className?` (`string`): Extra classes on the root element.
- `format?` (`(value: number) => string`): Formats a value. Default: the number in full, up to two decimals.
- `label?` (`ReactNode`): What is measured, before the numbers. Also the bar's accessible name.
- `max?` (`number`, default `100`): The goal.
- `size?` (`'stat' | 'headline'`, default `'stat'`): `headline`: the count at the figure step, for the one number that answers a view.
- `style?` (`CSSProperties`): Inline styles on the root element.
- `threshold?` (`number`): The level the value should reach. Under it, the bar takes `tone`; a tick marks it on the track.
- `tone?` (`ProgressTone`, default `'neutral'`): The bar's color under `threshold`. `neutral` is the accent; a full bar is the success color.
  `warning` and `danger` need a `threshold`: a tone with no rule is not drawn.
- `unit?` (`string`): The values' unit (see `withUnit`).
- `value` (`number`): How far, from 0.

Source: [ui/src/components/Progress.tsx:78](https://github.com/Tahul/zidane/blob/main/ui/src/components/Progress.tsx#L78)

## Functions

### `progressShare`

Function.

The share of `max` that `value` is, from 0 to 1.

```ts
function progressShare(value: number, max: number): number
```

**Parameters**

- `value` (`number`): How far.
- `max` (`number`): The goal.

**Returns** `number`

Source: [ui/src/components/Progress.tsx:50](https://github.com/Tahul/zidane/blob/main/ui/src/components/Progress.tsx#L50)

## Interfaces

### `ProgressProps`

Interface.

Props for [`Progress`](https://zidane.si/docs/reference/ui-components-progress.md#Progress).

```ts
interface ProgressProps
```

**Properties**

- `className?` (`string`): Extra classes on the root element.
- `format?` (`(value: number) => string`): Formats a value. Default: the number in full, up to two decimals.
- `label?` (`ReactNode`): What is measured, before the numbers. Also the bar's accessible name.
- `max?` (`number`, default `100`): The goal.
- `size?` (`'stat' | 'headline'`, default `'stat'`): `headline`: the count at the figure step, for the one number that answers a view.
- `style?` (`CSSProperties`): Inline styles on the root element.
- `threshold?` (`number`): The level the value should reach. Under it, the bar takes `tone`; a tick marks it on the track.
- `tone?` (`ProgressTone`, default `'neutral'`): The bar's color under `threshold`. `neutral` is the accent; a full bar is the success color.
  `warning` and `danger` need a `threshold`: a tone with no rule is not drawn.
- `unit?` (`string`): The values' unit (see `withUnit`).
- `value` (`number`): How far, from 0.

Source: [ui/src/components/Progress.tsx:17](https://github.com/Tahul/zidane/blob/main/ui/src/components/Progress.tsx#L17)

## Types

### `ProgressTone`

Type.

The color of a [`Progress`](https://zidane.si/docs/reference/ui-components-progress.md#Progress) bar.

```ts
type ProgressTone = 'neutral' | 'info' | 'success' | 'warning' | 'danger'
```

Source: [ui/src/components/Progress.tsx:14](https://github.com/Tahul/zidane/blob/main/ui/src/components/Progress.tsx#L14)
