1
1
---
2
2
layout : docs
3
3
title : Loading Buttons
4
- description : Buttons with built-in loading indicators. Indicate the loading state of the button bridging the gap between action and feedback .
4
+ description : Bootstrap loading buttons are interactive elements that provide visual feedback to users, indicating that an action is being processed. These buttons typically display a loading spinner or animation .
5
5
aliases :
6
6
- " /4.0/components/loading-buttons/"
7
7
toc : true
@@ -12,35 +12,64 @@ other_frameworks: loading-button
12
12
13
13
## Basic example
14
14
15
+ Create basic Bootstrap Loading Buttons with different styles: primary, outline, and ghost. These buttons show a loading state when clicked.
16
+
15
17
{{< example >}}
16
- <button type =" button " class =" btn btn-primary btn-loading " data-coreui-timeout =" 2000 " data-coreui-toggle =" loading-button " >Submit</button >
17
- <button type =" button " class =" btn btn-outline-primary btn-loading " data-coreui-toggle =" loading-button " >Submit</button >
18
- <button type =" button " class =" btn btn-ghost-primary btn-loading " data-coreui-toggle =" loading-button " >Submit</button >
18
+ <button type =" button " class =" btn btn-primary " data-coreui-timeout =" 2000 " data-coreui-toggle =" loading-button " >Submit</button >
19
+ <button type =" button " class =" btn btn-outline-primary " data-coreui-toggle =" loading-button " >Submit</button >
20
+ <button type =" button " class =" btn btn-ghost-primary " data-coreui-toggle =" loading-button " >Submit</button >
19
21
{{< /example >}}
20
22
21
23
## Spinners
22
24
23
25
### Border
24
26
27
+ The default option. Use loading buttons with a border spinner to indicate loading status.
28
+
25
29
{{< example >}}
26
- <button type =" button " class =" btn btn-info btn-loading " data-coreui-toggle =" loading-button " >Submit</button >
27
- <button type =" button " class =" btn btn-outline-success btn-loading " data-coreui-toggle =" loading-button " >Submit</button >
28
- <button type =" button " class =" btn btn-ghost-warning btn-loading " data-coreui-toggle =" loading-button " >Submit</button >
30
+ <button type =" button " class =" btn btn-info " data-coreui-toggle =" loading-button " >Submit</button >
31
+ <button type =" button " class =" btn btn-outline-success " data-coreui-toggle =" loading-button " >Submit</button >
32
+ <button type =" button " class =" btn btn-ghost-warning " data-coreui-toggle =" loading-button " >Submit</button >
29
33
{{< /example >}}
30
34
31
35
### Grow
32
36
37
+ Switch to a grow spinner for Bootstrap loading buttons by adding ` data-coreui-spinner-type="grow" ` .
38
+
33
39
{{< example >}}
34
- <button type =" button " class =" btn btn-info btn-loading " data-coreui-spinner-type =" grow " data-coreui-toggle =" loading-button " >Submit</button >
35
- <button type =" button " class =" btn btn-outline-success btn-loading " data-coreui-spinner-type =" grow " data-coreui-toggle =" loading-button " >Submit</button >
36
- <button type =" button " class =" btn btn-ghost-warning btn-loading " data-coreui-spinner-type =" grow " data-coreui-toggle =" loading-button " >Submit</button >
40
+ <button type =" button " class =" btn btn-info " data-coreui-spinner-type =" grow " data-coreui-toggle =" loading-button " >Submit</button >
41
+ <button type =" button " class =" btn btn-outline-success " data-coreui-spinner-type =" grow " data-coreui-toggle =" loading-button " >Submit</button >
42
+ <button type =" button " class =" btn btn-ghost-warning " data-coreui-spinner-type =" grow " data-coreui-toggle =" loading-button " >Submit</button >
37
43
{{< /example >}}
38
44
39
45
40
46
## Usage
41
47
42
48
{{< bootstrap-compatibility >}}
43
49
50
+ ### Via data attributes
51
+
52
+ Add ` data-coreui-toggle="loading-button" ` to a ` button ` element.
53
+
54
+ ``` html
55
+ <button type =" button" class =" btn btn-primary" data-coreui-toggle =" loading-button" >Submit</button >
56
+ ```
57
+
58
+ ### Via JavaScript
59
+
60
+ Call the loading button via JavaScript:
61
+
62
+ ``` html
63
+ <div class =" btn btn-primary btn-loading" ></div >
64
+ ```
65
+
66
+ ``` js
67
+ const loadingButtonElementList = Array .prototype .slice .call (document .querySelectorAll (' .btn-loading' ))
68
+ const loadingButtonList = loadingButtonElementList .map (loadingButtonEl => {
69
+ return new coreui.DatePicker (loadingButtonEl)
70
+ })
71
+ ```
72
+
44
73
### Options
45
74
46
75
{{< markdown >}}
@@ -50,10 +79,9 @@ other_frameworks: loading-button
50
79
{{< bs-table >}}
51
80
| Name | Type | Default | Description |
52
81
| --- | --- | --- | --- |
53
- | ` disabledOnLoading ` | boolean| ` false ` | |
54
- | ` spinner ` | boolean| ` true ` | |
55
- | ` spinnerType ` | string| ` 'border' ` | |
56
- | ` timeout ` | boolean \| number| ` false ` | |
82
+ | ` disabledOnLoading ` | boolean | ` false ` | Makes button disabled when loading. |
83
+ | ` spinnerType ` | 'border', 'grow' | ` 'border' ` | Sets type of spinner. |
84
+ | ` timeout ` | boolean, number | ` false ` | Automatically starts loading animation and stops after a determined amount of milliseconds. |
57
85
{{< /bs-table >}}
58
86
59
87
### Methods
0 commit comments