Search...

Spinner

React Bootstrap 5 Spinner

React Bootstrap 5 Spinner is an animation that helps improve the user experience by keeping visitors engaged while the page is loading.

Importing the React Bootstrap 5 Spinner Component

You import CDBSpinner into your project to use the Contrast React Bootstrap 5 Spinner component.

js
import { CDBSpinner } from 'cdbreact';

Default Spinner

The CDBSpinner component takes in characteristics like danger and success, which are 'color' prop values, to give the spinner a background color.

loading...
loading...
loading...
loading...
loading...
loading...
loading...
js
import React from 'react';
import { CDBSpinner, CDBContainer } from 'cdbreact';
export const Spinner = () => {
return (
<CDBContainer>
<CDBSpinner />
<CDBSpinner danger />
<CDBSpinner success />
<CDBSpinner warning />
<CDBSpinner info />
<CDBSpinner dark />
<CDBSpinner secondary />
</CDBContainer>
);
};

Multicolor Spinner

To give your spinner multiple colors, use the multicolor attribute.

loading...
js
import React from 'react';
import { CDBSpinner, CDBContainer } from 'cdbreact';
export const Spinner = () => {
return (
<CDBContainer>
<CDBSpinner multicolor />
</CDBContainer>
);
};

Size Variations

Use the size attribute to indicate how big or small your spinner should be.

loading...
loading...
loading...
js
import React from 'react';
import { CDBSpinner, CDBContainer } from 'cdbreact';
export const Spinner = () => {
return (
<CDBContainer>
<CDBSpinner size="big" />
<CDBSpinner secondary />
<CDBSpinner success size="small" />
</CDBContainer>
);
};

API Reference: Contrast React Bootstrap 5 Spinner Props

This section will expand on the props you'll be using with the Contrast React Bootstrap 5 Spinner component. You'll learn what these props do, how to utilize them, and what their default values are.

The table below details the CDBSpinner 's other prop selections.

NameTypeDefaultDescriptionExample
classNameStringAdds custom classesAdds custom classes<CDBSpinner className="myClass" ... />
tagStringdivChanges default input tag<CDBSpinner tag="input" ... />
sizeStringChanges the spinner's size. Choose one of the following keywords: 'large' or'small'.<CDBSpinner size="big" ... />
successBooleanfalseChanges the color of the spinner to green<CDBSpinner success .../>
secondaryBooleanfalseChanges the color of the spinner to purple<CDBSpinner secondary .../>
darkBooleanfalseChanges the color of the spinner to black<CDBSpinner dark .../>
infoBooleanfalseChanges the color of the spinner to teal<CDBSpinner info .../>
dangerBooleanfalseChanges the color of the spinner to red<CDBSpinner danger .../>
warningBooleanfalseChanges the color of the spinner to yellow<CDBSpinner warning .../>

Build modern projects using Bootstrap 5 and Contrast

Trying to create components and pages for a web app or website from scratch while maintaining a modern User interface can be very tedious. This is why we created Contrast, to help drastically reduce the amount of time we spend doing that. so we can focus on building some other aspects of the project.

Contrast Bootstrap PRO consists of a Premium UI Kit Library featuring over 10000+ component variants. Which even comes bundled together with its own admin template comprising of 5 admin dashboards and 23+ additional admin and multipurpose pages for building almost any type of website or web app.
See a demo and learn more about Contrast Bootstrap Pro by clicking here.