|
1 | | -### SCSS |
| 1 | +Use the **Loading** spinner to indicate a loading time between 1 and 7 seconds. For shorter loading times don't use any loader and for longer use a progress bar to indicate the remaining time. |
2 | 2 |
|
3 | | -#### Modifiers |
4 | | - |
5 | | -Use these modifiers with `.wfp--loading` class. |
6 | | - |
7 | | -| Selector | Description | |
8 | | -| -------------------------- | ---------------------------------------- | |
9 | | -| .wfp--loading--small | Class for small loading spinner | |
10 | | -| .wfp--loading--stop | Class for stopping the loading animation | |
11 | | -| .wfp--loading-overlay--stop | Class for hiding the overlay | |
12 | | - |
13 | | -### JavaScript |
14 | | - |
15 | | -#### Getting component class reference |
16 | | - |
17 | | -##### ES2015 |
18 | | - |
19 | | -```javascript |
20 | | -import { Loading } from 'carbon-components'; |
21 | | -``` |
22 | | - |
23 | | -##### With pre-build bundle (`carbon-components.min.js`) |
24 | | - |
25 | | -```javascript |
26 | | -var Loading = CarbonComponents.Loading; |
27 | | -``` |
28 | | - |
29 | | -#### Instantiating |
| 3 | +### Usage (react) |
30 | 4 |
|
31 | 5 | ```javascript |
32 | | -// `#my-loading` is an element with `[data-loading]` attribute |
33 | | -Loading.create(document.getElementById('my-loading')); |
34 | | -``` |
| 6 | +import { Loading } from '@wfp/ui'; |
35 | 7 |
|
36 | | -#### Public Methods |
37 | 8 |
|
38 | | -| Name | Params | Description | |
39 | | -| -------- | ---------------- | ----------------------------------------------------------- | |
40 | | -| release | | Deletes the instance | |
41 | | -| set | active : Boolean | Sets the active/inactive state | |
42 | | -| toggle | | Toggles active/inactive state | |
43 | | -| isActive | | Returns current state | |
44 | | -| end | | Runs end animation and then delete the element from the DOM | |
45 | | - |
46 | | -##### Example - Activating the loading spinner |
47 | | - |
48 | | -```javascript |
49 | | -// `#my-loading` is an element with `[data-loading]` attribute |
50 | | -var loadingInstance = Loading.create(document.getElementById('my-loading')); |
51 | | -loadingInstance.set(true); |
| 9 | +<Loading withOverlay={false} active /> |
52 | 10 | ``` |
53 | 11 |
|
54 | | -#### Options |
55 | | - |
56 | | -| Option | Default Selector | Description | |
57 | | -| ----------------------- | ------------------------- | ---------------------------------------------------------------- | |
58 | | -| selectorInit | [data-loading] | The CSS selector to find the loading component | |
59 | | -| selectorLoadingOverlay | .wfp--loading-overlay | The selector for the loading overlay. | |
60 | | -| classLoadingOverlayStop | wfp--loading-overlay--stop | The class for the loading overlay's stopped state. | |
61 | | -| active | true | A boolean value representing the initial state of the component. | |
| 12 | +#### css Modifiers |
62 | 13 |
|
63 | | -##### Example - Activating upon instantiating |
| 14 | +Use these modifiers with `.wfp--loading` class. |
64 | 15 |
|
65 | | -```javascript |
66 | | -// `#my-loading` is an element with `[data-loading]` attribute |
67 | | -Loading.create(document.getElementById('my-loading'), { active: true }); |
68 | | -``` |
| 16 | +| Selector | Description | |
| 17 | +| -------------------------- | ---------------------------------------- | |
| 18 | +| .wfp--loading--small | Class for small loading spinner | |
| 19 | +| .wfp--loading--stop | Class for stopping the loading animation | |
| 20 | +| .wfp--loading-overlay--stop | Class for hiding the overlay | |
0 commit comments