×

Ionic progress bar

The ionic progress bar element is a horizontal progress bar used to visualize the progression of operation and activity. You can use the <ion-progress-bar> component to create a progress bar in the ionic application.

There are two types of the ionic progress bar, which are as follows:

  • Determinate
  • Indeterminate

Determinate

When the percentage of operation is known, then you should use the determinate type. It is the default type of progress bar, and also value property represents the progress bar.

Example: This example explains how you can use the determinate progress bar in the ionic application.

Home.page.html

<ion-header>  
   <ion-toolbar color="primary">  
     <ion-title>Ionic Progress Bar</ion-title>  
   </ion-toolbar>  
 </ion-header>   
 <ion-content class="ion-padding" color="light">  
 <p>Default Progress Bar</p>  
 <ion-progress-bar></ion-progress-bar>   
 <p>Default Progress Bar at 60%</p>  
 <ion-progress-bar value="0.6"></ion-progress-bar>  
 </ion-content>   

Output: After executing this code you will get the output, which shown below:

Ionic progress bar

Indeterminate

It is a type of progress bar, which shows operation in progress. This means there is no requirement to indicate how long it will take time. If you add the reversed=“true” property, then you receive a query that is used to specify the pre-loading.

Example: The following example is used to explain how you can use the indeterminate progress bar in the ionic application.

Home.page.html

<ion-header>  
   <ion-toolbar color="primary">  
     <ion-title>Ionic Progress Bar</ion-title>  
   </ion-toolbar>  
 </ion-header>  
 <ion-content class="ion-padding" color="light">   
 <p>Indeterminate Progress Bar</p>  
 <ion-progress-bar type="indeterminate"></ion-progress-bar>     
 <p>Indeterminate Reversed</p>
 <ion-progress-bar type="indeterminate" reversed="true"></ion-progress-bar>  
 </ion-content>   

Output: After executing this code you will get the output, which shown below:

Ionic progress bar2

Buffer

The buffer displays the circle as an animation to specify some activity in the ionic application. If the buffer property value is less than one, the additional buffering progress can be shown.

Example: This example is used to explain how you can use the buffer attribute in the progress bar.

Home.page.html

<ion-header>  
   <ion-toolbar color="primary">  
     <ion-title>Ionic Progress Bar</ion-title>  
   </ion-toolbar>  
 </ion-header>     
 <ion-content class="ion-padding" color="light">  
 <p>Buffer Progress Bar</p>  
 <ion-progress-bar value="0.35" buffer="0.5"></ion-progress-bar>     
 <p>Progress Bar</p> 
 <ion-progress-bar value="0.20"></ion-progress-bar>  
 </ion-content>   

Output: After executing this code you will get the output, which is shown below:

Ionic progress bar3

Colorization of the Progress bar

You can use the <ion-progress-bar> component to configure the color in the progress bar. Here, you can add the different colors in the ionic progress bar.

Example: This example is used to explain how you can use the color property in the ionic progress bar.

Home.page.html

<ion-header>  
 <ion-progress-bar value="0.20"></ion-progress-bar>  
 </ion-content>   
   <ion-toolbar color="primary">  
     <ion-title>Ionic Progress Bar</ion-title>  
   </ion-toolbar>  
 </ion-header>   
 <ion-content class="ion-padding" color="light">  
 <p>Colorize Progress Bar</p>  
 <ion-progress-bar value="0.35" color="danger"></ion-progress-bar><br>     
 <ion-progress-bar value="0.20" color="success"></ion-progress-bar><br>
 <ion-progress-bar value="0.50" color="primary"></ion-progress-bar><br>
 <ion-progress-bar value="0.40" color="warning"></ion-progress-bar><br>
 <ion-progress-bar value="0.60" color="tertiary"></ion-progress-bar>
 </ion-content>   

Output: After executing this code you will get the output, which is shown below:

Ionic progress bar4

Bind a variable with Progress Bar

You can also bind the progress bar with the value in the ionic application. For doing this, you required to add the value in square brackets, which calls the variable that binds to this value property.

Example: This example is used to explain how you can bind a variable with the progress bar.

Home.page.html

<ion-header>  
   <ion-toolbar color="primary">  
     <ion-title>Ionic Progress Bar</ion-title>  
   </ion-toolbar>  
 </ion-header> 
 <ion-content class="ion-padding" color="light">  
 <p>Bind a variable</p>  
 <ion-progress-bar [value]="progress" color="danger"></ion-progress-bar>     
 </ion-content>  

Home.page.ts   

In the home.page.ts file, you can set the time interval to load the progress bar.

import { Component } from
'@angular/core';  
 @Component({  
   selector: 'app-home',  
   templateUrl: 'home.page.html',  
   styleUrls: ['home.page.scss'],  
 })  
 export class HomePage {  
   progress = 0.20;   
   constructor() {  
     setInterval( () => {  
       this.progress += .1;  
       }, 1000 );  
   }  
 }   

Output: After executing this code you will get the output, which is shown below:

Ionic progress bar5

When the time interval is completed then it shows something like this.

Ionic progress bar6

Related Topics

Ionic Loading

The ionic loader is an overlay that can be used to indicate activity, the user interaction while blocking. The ionic loader shows on the top of the app content, and it can...

5 minutes read.

Ionic-fab Button

Ionic-fab Button The Ionic FABs (Floating Action Buttons) are standard material design compounds. It is a container element that contains one or more fab buttons. They are required to be placed in a fixed position,...

2 minutes read.

Ionic Actionsheet

Ionic Actionsheet The Action sheet is a dialog box that displays a group of options. It is shown on the top of the application content and must be dismissed manually before the user can resume...

3 minutes read.

Ionic Toolbar

A toolbar is a general toolbar that can be used in an application such as a header, sub-header, footer, or even a sub-footer. Because the ion-toolbar is flexbox-dependent, no matter how many toolbars...

3 minutes read.

Ionic vs PhoneGap

Ionic Vs PhoneGap Ionic and PhoneGap are both used to develop the mobile application. Both Frameworks are used in large enterprises by the developers. Here, we are going to compare the important differences between ionic...

3 minutes read.

Ionic Modal

Ionic modal is displayed as a temporary UI that slides into the screen. The ionic modal is a dialog box that is displayed at the top of the app’s content, and it...

5 minutes read.

Ionic vs Apache Cordova

Ionic Vs Apache Cordova Ionic and Cordova are two popular technology going on in the market for mobile application development. The combination of these two technologies creates a development platform that is known as...

3 minutes read.

Ionic Infinite Scroll

The infinite scroll permits you to perform an action when the user scrolls a particular content from the bottom or top of the page. When you display the large collection of data...

3 minutes read.

Ionic Tutorial for Beginners

What is Ionic? Ionic is an open-source framework that is used for the development of mobile applications. It is also used to build android applications, iOS, applications, desktop applications, and web applications using web...

4 minutes read.

History of Ionic

It is a complete open-source platform for hybrid mobile application development created by Ben Sperry, Max Lynch, and Adam Bradley of Drifty Co. in 2013. The first alpha version of the framework was...

2 minutes read.

Ionic Cards

Ionic Cards: Ionic cards are a standard part of the user interface that acts as an entry point for more specific information. These are the best components for displaying information...

4 minutes read.

Ionic Popover

The Ionic popover is a small dialog box that displays at the top of the screen. It can be used for anything, but it is usually used for a button, an action,...

4 minutes read.

Ionic vs React Native

Ionic Vs React Native Ionic and React Native are both common framework which is used to develop mobile applications. Here, you will know about the popular differences between the ionic and the React Native. Ionic Ionic...

3 minutes read.

Ionic Radio

Ionic Radio The radio button is the type of input component that has a Boolean value. The Ionic radio button has a different pattern on every platform, as well as other Ionic components....

2 minutes read.

Features of Ionic Framework

The Ionic Framework is based on the AngularJS framework that permits a programmer to use a combination of many other programming languages, like HTML5, CSS, and JavaScript. Some of the...

4 minutes read.

Ionic Segment

A segment is a collection of buttons, sometimes which are known as segmented controls. The segment buttons are displayed at horizontal rows. These segment buttons can be shown in a toolbar or the...

2 minutes read.

Ionic Alert

Ionic Alert An Alert is a dialog box that presents the users with important information, or it stores the data from the user by using the inputs. Alerts are a great way to provide...

5 minutes read.

Ionic Buttons

Ionic Buttons There are different types of buttons in the Ionic framework. These buttons are subtly animated, enhancing the user experience when using the application. Buttons are a fundamental way of interacting and navigating...

4 minutes read.

Ionic Date Time

Ionic Date Time The DateTime component is used to display an interface that makes it simple for users to select dates and times. Tapping on <ion-datetime> will display a slider up from the...

4 minutes read.

Ionic Splash Screen

The Apache Cordova plugin helps to displays and hides a splash screen during the application launch. The Ionic Splash Screen is similar to a home page on a website. The ionic splash...

2 minutes read.