Loading management
Bootstrap 5 Loading management
Displays animation in a container (such as a table) while loading data.
Note: Read the API tab to find all available options and advanced customization
Basic example
Loading automatically init when you add class loading
to your element. Loading
automatically attach to body
element, so if you want attach loading to element
you have add data-mdb-parent-selector
with class or id of your parent or by
javascript with parentSelector
option.
JavaScript init
You can init loading component with JavaScript with
new Loading(element, options)
.
Colors
You can set a different colors to loader with text-*
color like primary, success,
danger, warning.
Custom spinners
MDB Growing spinner
If you don’t fancy a border spinner, switch to the grow spinner. While it doesn’t technically spin, it does repeatedly grow!
Font Awesome
Use font awesome spinner icon to indicate loading status.
Delay
Use following code to delay the appearance of loading spinner.
Full screen
Use the code below to add spinner for larger content areas or for full-screen loading.
Loading management - API
Usage
Via classes
Via data attributes
Via JavaScript
Via jQuery
Note: By default, MDB does not include jQuery and you have to add it to the project on your own.
Options
Name | Type | Default | Description |
---|---|---|---|
backdrop
|
null || boolean | true |
Set loader backdrop/td> |
backdropColor
|
string | rgba(0, 0, 0) |
Set loader backdrop color |
backdropOpacity
|
number || string | 0.4 |
Set loader backdrop opacity |
backdropID
|
null || number | '' |
Set loader backdrop ID |
delay |
null | null |
Set deley to show loader |
loader |
string | '' |
Set ID of loader |
parentSelector
|
null | null |
Set parent of loader. It can be every element with class or id |
scroll |
boolean | true |
Set scroll to backdrop |
loadingText
|
boolean | true |
Set text to loader |
loadingIcon
|
boolean | true |
Set loading icon to lader |
Methods
Name | Description | Example |
---|---|---|
toggle |
Manually toggles a loader |
myLoader.toggle()
|
getInstance
|
Static method which allows you to get the loading management instance associated to a DOM element. |
LoadingManagement.getInstance(myLoader)
|
getOrCreateInstance
|
Static method which returns the loading management instance associated to a DOM element or create a new one in case it wasn't initialized. |
LoadingManagement.getOrCreateInstance(myLoader)
|
Import
MDB UI KIT also works with module bundlers. Use the following code to import this component: