# ion-progress-bar

URL: https://ionicframework.com/docs/api/progress-bar

**Encapsulation**: [shadow](/docs/reference/glossary.md#shadow)

Progress bars inform users about the status of ongoing processes, such as loading an app, submitting a form, or saving updates. There are two types of progress bars: `determinate` and `indeterminate`.

## Determinate

Determinate is the default type. It should be used when the percentage of an operation is known. The progress is represented by setting the `value` property. This can be used to show the progress increasing from 0 to 100% of the track.

**JavaScript**

```html
<ion-progress-bar></ion-progress-bar>

<script>
  let progress = 0;
  let progressBar = document.querySelector('ion-progress-bar');

  setInterval(() => {
    progressBar.value = progress += 0.01;

    // Reset the progress bar when it reaches 100%
    // to continuously show the demo
    if (progress > 1) {
      setTimeout(() => {
        progressBar.value = progress = 0;
      }, 1000);
    }
  }, 50);
</script>
```

**Angular**

`src/app/example.component.html`

```html
<ion-progress-bar [value]="progress()"></ion-progress-bar>
```

`src/app/example.component.ts`

```ts
import { Component, signal } from '@angular/core';
import { IonProgressBar } from '@ionic/angular';

@Component({
  selector: 'app-example',
  templateUrl: 'example.component.html',
  styleUrls: ['example.component.css'],
  imports: [IonProgressBar],
})
export class ExampleComponent {
  readonly progress = signal(0);

  constructor() {
    setInterval(() => {
      this.progress.update((value) => value + 0.01);

      // Reset the progress bar when it reaches 100%
      // to continuously show the demo
      if (this.progress() > 1) {
        setTimeout(() => {
          this.progress.set(0);
        }, 1000);
      }
    }, 50);
  }
}
```

**React**

```tsx
import React, { useEffect, useState } from 'react';
import { IonProgressBar } from '@ionic/react';

function Example() {
  const [progress, setProgress] = useState(0);

  useEffect(() => {
    const interval = setInterval(() => {
      setProgress((prevProgress) => prevProgress + 0.01);
    }, 50);

    return () => clearInterval(interval);
  }, []);

  if (progress > 1) {
    setTimeout(() => {
      setProgress(0);
    }, 1000);
  }

  return <IonProgressBar value={progress}></IonProgressBar>;
}
export default Example;
```

**Vue**

```vue
<template>
  <ion-progress-bar :value="progress"></ion-progress-bar>
</template>

<script setup lang="ts">
import { IonProgressBar } from '@ionic/vue';
import { ref, onMounted } from 'vue';

const progress = ref(0);

onMounted(() => {
  setInterval(() => {
    progress.value += 0.01;

    // Reset the progress bar when it reaches 100%
    // to continuously show the demo
    if (progress.value > 1) {
      setTimeout(() => {
        progress.value = 0;
      }, 1000);
    }
  }, 50);
});
</script>
```

### Buffer

If the `buffer` property is set, a buffer stream will show with animated circles to indicate activity. The value of the `buffer` property will also be represented by how much visible track there is. If the value of `buffer` is less than the `value` property, there will be no visible track. If `buffer` is equal to `1` then the buffer stream will be hidden.

**JavaScript**

```html
<ion-progress-bar></ion-progress-bar>

<script>
  let buffer = 0.06;
  let progress = 0;

  let progressBar = document.querySelector('ion-progress-bar');
  progressBar.buffer = buffer;

  setInterval(() => {
    progressBar.buffer = buffer += 0.06;
    progressBar.value = progress += 0.06;

    // Reset the progress bar when it reaches 100%
    // to continuously show the demo
    if (progress > 1) {
      setTimeout(() => {
        progressBar.buffer = buffer = 0.06;
        progressBar.value = progress = 0;
      }, 1000);
    }
  }, 1000);
</script>
```

**Angular**

`src/app/example.component.html`

```html
<ion-progress-bar [buffer]="buffer()" [value]="progress()"></ion-progress-bar>
```

`src/app/example.component.ts`

```ts
import { Component, signal } from '@angular/core';
import { IonProgressBar } from '@ionic/angular';

@Component({
  selector: 'app-example',
  templateUrl: 'example.component.html',
  styleUrls: ['example.component.css'],
  imports: [IonProgressBar],
})
export class ExampleComponent {
  readonly buffer = signal(0.06);
  readonly progress = signal(0);

  constructor() {
    setInterval(() => {
      this.buffer.update((value) => value + 0.06);
      this.progress.update((value) => value + 0.06);

      // Reset the progress bar when it reaches 100%
      // to continuously show the demo
      if (this.progress() > 1) {
        setTimeout(() => {
          this.buffer.set(0.06);
          this.progress.set(0);
        }, 1000);
      }
    }, 1000);
  }
}
```

**React**

```tsx
import React, { useEffect, useState } from 'react';
import { IonProgressBar } from '@ionic/react';

function Example() {
  const [buffer, setBuffer] = useState(0.06);
  const [progress, setProgress] = useState(0);

  useEffect(() => {
    const interval = setInterval(() => {
      setBuffer((prevBuffer) => prevBuffer + 0.06);
      setProgress((prevProgress) => prevProgress + 0.06);
    }, 1000);

    return () => clearInterval(interval);
  }, []);

  if (progress > 1) {
    setTimeout(() => {
      setBuffer(0.06);
      setProgress(0);
    }, 1000);
  }

  return <IonProgressBar buffer={buffer} value={progress}></IonProgressBar>;
}
export default Example;
```

**Vue**

```vue
<template>
  <ion-progress-bar :buffer="buffer" :value="progress"></ion-progress-bar>
</template>

<script setup lang="ts">
import { IonProgressBar } from '@ionic/vue';
import { ref, onMounted } from 'vue';

const buffer = ref(0.06);
const progress = ref(0);

onMounted(() => {
  setInterval(() => {
    buffer.value += 0.06;
    progress.value += 0.06;

    // Reset the progress bar when it reaches 100%
    // to continuously show the demo
    if (progress.value > 1) {
      setTimeout(() => {
        buffer.value = 0.06;
        progress.value = 0;
      }, 1000);
    }
  }, 1000);
});
</script>
```

## Indeterminate

The indeterminate type should be used when it is unknown how long the process will take. The progress bar is not tied to the `value`, instead it continually slides along the track until the process is complete.

**JavaScript**

```html
<ion-progress-bar type="indeterminate"></ion-progress-bar>
```

**Angular**

`src/app/example.component.html`

```html
<ion-progress-bar type="indeterminate"></ion-progress-bar>
```

`src/app/example.component.ts`

```ts
import { Component } from '@angular/core';
import { IonProgressBar } from '@ionic/angular';

@Component({
  selector: 'app-example',
  templateUrl: 'example.component.html',
  styleUrls: ['example.component.css'],
  imports: [IonProgressBar],
})
export class ExampleComponent {}
```

**React**

```tsx
import React from 'react';
import { IonProgressBar } from '@ionic/react';

function Example() {
  return <IonProgressBar type="indeterminate"></IonProgressBar>;
}
export default Example;
```

**Vue**

```vue
<template>
  <ion-progress-bar type="indeterminate"></ion-progress-bar>
</template>

<script setup lang="ts">
import { IonProgressBar } from '@ionic/vue';
</script>
```

## Progress Bars in Toolbars

**JavaScript**

```html
<ion-header>
  <ion-toolbar>
    <ion-title>Toolbar</ion-title>
    <ion-progress-bar type="indeterminate"></ion-progress-bar>
  </ion-toolbar>
</ion-header>
```

**Angular**

`src/app/example.component.html`

```html
<ion-header>
  <ion-toolbar>
    <ion-title>Toolbar</ion-title>
    <ion-progress-bar type="indeterminate"></ion-progress-bar>
  </ion-toolbar>
</ion-header>
```

`src/app/example.component.ts`

```ts
import { Component } from '@angular/core';
import { IonHeader, IonProgressBar, IonTitle, IonToolbar } from '@ionic/angular';

@Component({
  selector: 'app-example',
  templateUrl: 'example.component.html',
  styleUrls: ['example.component.css'],
  imports: [IonHeader, IonProgressBar, IonTitle, IonToolbar],
})
export class ExampleComponent {}
```

**React**

```tsx
import React from 'react';
import { IonHeader, IonProgressBar, IonTitle, IonToolbar } from '@ionic/react';

function Example() {
  return (
    <IonHeader>
      <IonToolbar>
        <IonTitle>Toolbar</IonTitle>
        <IonProgressBar type="indeterminate"></IonProgressBar>
      </IonToolbar>
    </IonHeader>
  );
}
export default Example;
```

**Vue**

```vue
<template>
  <ion-header>
    <ion-toolbar>
      <ion-title>Toolbar</ion-title>
      <ion-progress-bar type="indeterminate"></ion-progress-bar>
    </ion-toolbar>
  </ion-header>
</template>

<script setup lang="ts">
import { IonHeader, IonProgressBar, IonTitle, IonToolbar } from '@ionic/vue';
</script>
```

## Theming

### Colors

**JavaScript**

```html
<ion-progress-bar type="indeterminate" color="primary"></ion-progress-bar>
<ion-progress-bar type="indeterminate" color="secondary"></ion-progress-bar>
<ion-progress-bar type="indeterminate" color="tertiary"></ion-progress-bar>
<ion-progress-bar type="indeterminate" color="success"></ion-progress-bar>
<ion-progress-bar type="indeterminate" color="warning"></ion-progress-bar>
<ion-progress-bar type="indeterminate" color="danger"></ion-progress-bar>
<ion-progress-bar type="indeterminate" color="light"></ion-progress-bar>
<ion-progress-bar type="indeterminate" color="medium"></ion-progress-bar>
<ion-progress-bar type="indeterminate" color="dark"></ion-progress-bar>
```

**Angular**

`src/app/example.component.html`

```html
<ion-progress-bar type="indeterminate" color="primary"></ion-progress-bar>
<ion-progress-bar type="indeterminate" color="secondary"></ion-progress-bar>
<ion-progress-bar type="indeterminate" color="tertiary"></ion-progress-bar>
<ion-progress-bar type="indeterminate" color="success"></ion-progress-bar>
<ion-progress-bar type="indeterminate" color="warning"></ion-progress-bar>
<ion-progress-bar type="indeterminate" color="danger"></ion-progress-bar>
<ion-progress-bar type="indeterminate" color="light"></ion-progress-bar>
<ion-progress-bar type="indeterminate" color="medium"></ion-progress-bar>
<ion-progress-bar type="indeterminate" color="dark"></ion-progress-bar>
```

`src/app/example.component.ts`

```ts
import { Component } from '@angular/core';
import { IonProgressBar } from '@ionic/angular';

@Component({
  selector: 'app-example',
  templateUrl: 'example.component.html',
  styleUrls: ['example.component.css'],
  imports: [IonProgressBar],
})
export class ExampleComponent {}
```

**React**

```tsx
import React from 'react';
import { IonProgressBar } from '@ionic/react';

function Example() {
  return (
    <>
      <IonProgressBar type="indeterminate" color="primary"></IonProgressBar>
      <IonProgressBar type="indeterminate" color="secondary"></IonProgressBar>
      <IonProgressBar type="indeterminate" color="tertiary"></IonProgressBar>
      <IonProgressBar type="indeterminate" color="success"></IonProgressBar>
      <IonProgressBar type="indeterminate" color="warning"></IonProgressBar>
      <IonProgressBar type="indeterminate" color="danger"></IonProgressBar>
      <IonProgressBar type="indeterminate" color="light"></IonProgressBar>
      <IonProgressBar type="indeterminate" color="medium"></IonProgressBar>
      <IonProgressBar type="indeterminate" color="dark"></IonProgressBar>
    </>
  );
}
export default Example;
```

**Vue**

```vue
<template>
  <ion-progress-bar type="indeterminate" color="primary"></ion-progress-bar>
  <ion-progress-bar type="indeterminate" color="secondary"></ion-progress-bar>
  <ion-progress-bar type="indeterminate" color="tertiary"></ion-progress-bar>
  <ion-progress-bar type="indeterminate" color="success"></ion-progress-bar>
  <ion-progress-bar type="indeterminate" color="warning"></ion-progress-bar>
  <ion-progress-bar type="indeterminate" color="danger"></ion-progress-bar>
  <ion-progress-bar type="indeterminate" color="light"></ion-progress-bar>
  <ion-progress-bar type="indeterminate" color="medium"></ion-progress-bar>
  <ion-progress-bar type="indeterminate" color="dark"></ion-progress-bar>
</template>

<script setup lang="ts">
import { IonProgressBar } from '@ionic/vue';
</script>
```

### CSS Custom Properties

**JavaScript**

```html
<style>
  ion-progress-bar {
    --background: #f3e895;
    --progress-background: #09c567;
  }
</style>

<ion-progress-bar value=".25" buffer=".5"></ion-progress-bar>
<ion-progress-bar type="indeterminate"></ion-progress-bar>
```

**Angular**

`src/app/example.component.html`

```html
<ion-progress-bar value=".25" buffer=".5"></ion-progress-bar> <ion-progress-bar type="indeterminate"></ion-progress-bar>
```

`src/app/example.component.css`

```css
ion-progress-bar {
  --background: #f3e895;
  --progress-background: #09c567;
}
```

`src/app/example.component.ts`

```ts
import { Component } from '@angular/core';
import { IonProgressBar } from '@ionic/angular';

@Component({
  selector: 'app-example',
  templateUrl: 'example.component.html',
  styleUrls: ['example.component.css'],
  imports: [IonProgressBar],
})
export class ExampleComponent {}
```

**React**

`src/main.tsx`

```tsx
import React from 'react';
import { IonProgressBar } from '@ionic/react';

import './main.css';

function Example() {
  return (
    <>
      <IonProgressBar value={0.25} buffer={0.5}></IonProgressBar>
      <IonProgressBar type="indeterminate"></IonProgressBar>
    </>
  );
}
export default Example;
```

`src/main.css`

```css
ion-progress-bar {
  --background: #f3e895;
  --progress-background: #09c567;
}
```

**Vue**

```vue
<template>
  <ion-progress-bar :value="0.25" :buffer="0.5"></ion-progress-bar>
  <ion-progress-bar type="indeterminate"></ion-progress-bar>
</template>

<script setup lang="ts">
import { IonProgressBar } from '@ionic/vue';
</script>

<style scoped>
ion-progress-bar {
  --background: #f3e895;
  --progress-background: #09c567;
}
</style>
```

### CSS Shadow Parts

**JavaScript**

```html
<style>
  ion-progress-bar::part(track) {
    background: #f3e895;
  }

  ion-progress-bar::part(progress) {
    background: #09c567;
  }

  ion-progress-bar::part(stream) {
    background-image: radial-gradient(ellipse at center, #e475f3 0%, #e475f3 30%, transparent 30%);
  }
</style>

<ion-progress-bar value=".25" buffer=".5"></ion-progress-bar>
<ion-progress-bar type="indeterminate"></ion-progress-bar>
```

**Angular**

`src/app/example.component.html`

```html
<ion-progress-bar value=".25" buffer=".5"></ion-progress-bar> <ion-progress-bar type="indeterminate"></ion-progress-bar>
```

`src/app/example.component.css`

```css
ion-progress-bar::part(track) {
  background: #f3e895;
}

ion-progress-bar::part(progress) {
  background: #09c567;
}

ion-progress-bar::part(stream) {
  background-image: radial-gradient(ellipse at center, #e475f3 0%, #e475f3 30%, transparent 30%);
}
```

`src/app/example.component.ts`

```ts
import { Component } from '@angular/core';
import { IonProgressBar } from '@ionic/angular';

@Component({
  selector: 'app-example',
  templateUrl: 'example.component.html',
  styleUrls: ['example.component.css'],
  imports: [IonProgressBar],
})
export class ExampleComponent {}
```

**React**

`src/main.tsx`

```tsx
import React from 'react';
import { IonProgressBar } from '@ionic/react';

import './main.css';

function Example() {
  return (
    <>
      <IonProgressBar value={0.25} buffer={0.5}></IonProgressBar>
      <IonProgressBar type="indeterminate"></IonProgressBar>
    </>
  );
}
export default Example;
```

`src/main.css`

```css
ion-progress-bar::part(track) {
  background: #f3e895;
}

ion-progress-bar::part(progress) {
  background: #09c567;
}

ion-progress-bar::part(stream) {
  background-image: radial-gradient(ellipse at center, #e475f3 0%, #e475f3 30%, transparent 30%);
}
```

**Vue**

```vue
<template>
  <ion-progress-bar value=".25" buffer=".5"></ion-progress-bar>
  <ion-progress-bar type="indeterminate"></ion-progress-bar>
</template>

<script setup lang="ts">
import { IonProgressBar } from '@ionic/vue';
</script>

<style scoped>
ion-progress-bar::part(track) {
  background: #f3e895;
}

ion-progress-bar::part(progress) {
  background: #09c567;
}

ion-progress-bar::part(stream) {
  background-image: radial-gradient(ellipse at center, #e475f3 0%, #e475f3 30%, transparent 30%);
}
</style>
```

## Properties

### buffer

**Description**: If the buffer and value are smaller than 1, the buffer circles will show. The buffer should be between [0, 1].

**Attribute**: `buffer`

**Type**: `number`

**Default**: `1`

### color

**Description**: The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics.md).

**Attribute**: `color`

**Type**: `"danger" | "dark" | "light" | "medium" | "primary" | "secondary" | "success" | "tertiary" | "warning" | string | undefined`

**Default**: `undefined`

### mode

**Description**: The mode determines which platform styles to use. This is a [virtual property](/docs/core-concepts/fundamentals.md#virtual-properties) that is set once during initialization and will not update if you change its value after the initial render.

**Attribute**: `mode`

**Type**: `"ios" | "md"`

**Default**: `undefined`

### reversed

**Description**: If true, reverse the progress bar direction.

**Attribute**: `reversed`

**Type**: `boolean`

**Default**: `false`

### type

**Description**: The state of the progress bar, based on if the time the process takes is known or not. Default options are: `"determinate"` (no animation), `"indeterminate"` (animate from left to right).

**Attribute**: `type`

**Type**: `"determinate" | "indeterminate"`

**Default**: `'determinate'`

### value

**Description**: The value determines how much of the active bar should display when the `type` is `"determinate"`. The value should be between [0, 1].

**Attribute**: `value`

**Type**: `number`

**Default**: `0`

## Events

No events available for this component.

## Methods

No public methods available for this component.

## CSS Shadow Parts

| Name | Description |
| --- | --- |
| `progress` | The progress bar that shows the current value when `type` is `"determinate"` and slides back and forth when `type` is `"indeterminate"`. |
| `stream` | The animated circles that appear while buffering. This only shows when `buffer` is set and `type` is `"determinate"`. |
| `track` | The track bar behind the progress bar. If the `buffer` property is set and `type` is `"determinate"` the track will be the width of the `buffer` value. |

## CSS Custom Properties

**iOS**

| Name | Description |
| --- | --- |
| `--background` | Background of the progress track, or the buffer bar if `buffer` is set |
| `--progress-background` | Background of the progress bar representing the current value |

**MD**

| Name | Description |
| --- | --- |
| `--background` | Background of the progress track, or the buffer bar if `buffer` is set |
| `--progress-background` | Background of the progress bar representing the current value |

## Slots

No slots available for this component.
