The ionic spinner component provides the various SVG (Scalable Vector Graphic) spinners. Ionic spinners are the visual indicators that display the app which is loading content or performing another process that the user needs to wait on.

The default spinner is different for every platform. Such as, the android application has the default spinner “lines”, while the default spinner “crescent” for the iOS application. If the platform neither iOS nor android, then the default spinner will be “crescent”. If the name property is set, then that spinner will be used instead of the platform particular spinner. You can use the <ion-spinner> component to create the spinner in the ionic application.

Example: This example explains how you can use the default spinner in the ionic application.

Home.page.html

Output: After executing this code, you will get the output, which is shown below. Here you can see the default spinner in the ionic application. The default spinner is line.

Ionic Spinner

By using the name property, you can set several types of spinner in the <ion-spinner> component. Such types of the spinner are lines, circles, dots, bubbles, crescent, etc.

Example: This example explains how you can use the different types of the spinner in the ionic application.

Home.page.html

Output: After executing this code, you will get the output, which is shown below. Here can you see the different types of the spinners in the ionic application.

Ionic Spinner2

Setting Time

The Ionic permits the user to set the time duration to the spinner component. It means that when the time you specified is reached, the visual loading indications of the Spinner component will be disappeared.

Example: This example explains how you can set the time in the spinner.

Home.page.html

Home.page.ts

In the home.page.ts file, you have to set the time duration to the spinner component.

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

Ionic Spinner3

When the time limit is reached which you have set, then the bubbles loading spinner will be disappeared, as shown below:

Ionic Spinner4

Pause Spinner

It provides an attribute to the user to pause the animation of the spinner component. By default, the paused attribute is false. If the pause attribute is true, then the spinner animation will be paused. You can set the paused attribute in the <ion-spinner> component.

Example: This example explains how you can set the paused attribute in the spinner component. Here, we have set the paused attribute in the bubble’s spinner.

Home.page.html

Output: After executing this code, you will get the output, which is shown below. Here, you can see that the bubble’s spinner is paused in the application.

Ionic Spinner5

Styling the Spinner

It allows the user to set the different styling or color for the spinner component. You can set the color property in the <ion-spinner> component.

Example: This example explains how you can use the styling or color in the spinner component.

Home.page.html

Output: After executing this code, you will get the output, which is shown below. Here, you can see the different colors and styles of the spinners.

Ionic Spinner6

Pin It on Pinterest

Share This