| 1 |
--- |
| 2 |
id: Spinner |
| 3 |
section: components |
| 4 |
cssPrefix: pf-v6-c-spinner |
| 5 |
---## Examples |
| 6 |
|
| 7 |
### Basic |
| 8 |
|
| 9 |
```html |
| 10 |
<svg |
| 11 |
class="pf-v6-c-spinner" |
| 12 |
role="progressbar" |
| 13 |
viewBox="0 0 100 100" |
| 14 |
aria-label="Loading..." |
| 15 |
> |
| 16 |
<circle class="pf-v6-c-spinner__path" cx="50" cy="50" r="45" fill="none" /> |
| 17 |
</svg> |
| 18 |
|
| 19 |
``` |
| 20 |
|
| 21 |
### Sizes |
| 22 |
|
| 23 |
```html |
| 24 |
<svg |
| 25 |
class="pf-v6-c-spinner pf-m-xs" |
| 26 |
role="progressbar" |
| 27 |
viewBox="0 0 100 100" |
| 28 |
aria-label="Loading..." |
| 29 |
> |
| 30 |
<circle class="pf-v6-c-spinner__path" cx="50" cy="50" r="45" fill="none" /> |
| 31 |
</svg> |
| 32 |
|
| 33 |
<svg |
| 34 |
class="pf-v6-c-spinner pf-m-sm" |
| 35 |
role="progressbar" |
| 36 |
viewBox="0 0 100 100" |
| 37 |
aria-label="Loading..." |
| 38 |
> |
| 39 |
<circle class="pf-v6-c-spinner__path" cx="50" cy="50" r="45" fill="none" /> |
| 40 |
</svg> |
| 41 |
|
| 42 |
<svg |
| 43 |
class="pf-v6-c-spinner pf-m-md" |
| 44 |
role="progressbar" |
| 45 |
viewBox="0 0 100 100" |
| 46 |
aria-label="Loading..." |
| 47 |
> |
| 48 |
<circle class="pf-v6-c-spinner__path" cx="50" cy="50" r="45" fill="none" /> |
| 49 |
</svg> |
| 50 |
|
| 51 |
<svg |
| 52 |
class="pf-v6-c-spinner pf-m-lg" |
| 53 |
role="progressbar" |
| 54 |
viewBox="0 0 100 100" |
| 55 |
aria-label="Loading..." |
| 56 |
> |
| 57 |
<circle class="pf-v6-c-spinner__path" cx="50" cy="50" r="45" fill="none" /> |
| 58 |
</svg> |
| 59 |
|
| 60 |
<svg |
| 61 |
class="pf-v6-c-spinner pf-m-xl" |
| 62 |
role="progressbar" |
| 63 |
viewBox="0 0 100 100" |
| 64 |
aria-label="Loading..." |
| 65 |
> |
| 66 |
<circle class="pf-v6-c-spinner__path" cx="50" cy="50" r="45" fill="none" /> |
| 67 |
</svg> |
| 68 |
|
| 69 |
``` |
| 70 |
|
| 71 |
### Inline |
| 72 |
|
| 73 |
An inline spinner inherits its font-size, so its size will match the content around it. |
| 74 |
|
| 75 |
```html |
| 76 |
<svg |
| 77 |
class="pf-v6-c-spinner pf-m-inline" |
| 78 |
role="progressbar" |
| 79 |
viewBox="0 0 100 100" |
| 80 |
aria-label="Loading..." |
| 81 |
> |
| 82 |
<circle class="pf-v6-c-spinner__path" cx="50" cy="50" r="45" fill="none" /> |
| 83 |
</svg> |
| 84 |
|
| 85 |
``` |
| 86 |
|
| 87 |
### Custom size |
| 88 |
|
| 89 |
```html |
| 90 |
<svg |
| 91 |
class="pf-v6-c-spinner" |
| 92 |
role="progressbar" |
| 93 |
viewBox="0 0 100 100" |
| 94 |
aria-label="Loading..." |
| 95 |
style="--pf-v6-c-spinner--diameter: 80px;" |
| 96 |
> |
| 97 |
<circle class="pf-v6-c-spinner__path" cx="50" cy="50" r="45" fill="none" /> |
| 98 |
</svg> |
| 99 |
|
| 100 |
``` |
| 101 |
|
| 102 |
## Documentation |
| 103 |
|
| 104 |
### Accessibility |
| 105 |
|
| 106 |
| Attribute | Applied to | Outcome | |
| 107 |
| -- | -- | -- | |
| 108 |
| `role="progressbar"` | `.pf-v6-c-spinner` | Indicates to assistive technologies that this is an indeterminate progress indicator. | |
| 109 |
| `aria-label="Loading..."` | `.pf-v6-c-spinner` | Provides an accessible name for the spinner. **Note: one of `aria-label` or `aria-labelledby` is required.** | |
| 110 |
| `aria-labelledby="[id of spinner label]"` | `.pf-v6-c-spinner` | Gives the spinner an accessible name by referring to the element that labels the spinner. | |
| 111 |
| `aria-describedby="[id of spinner description]"` | `.pf-v6-c-spinner` | Gives the spinner an accessible description by referring to the element that describes the spinner. | |
| 112 |
|
| 113 |
Note: If the spinner is showing that loading of a particular region of a page is in process, the author should use `aria-describedby` to point to the status, and set the `aria-busy` attribute to `true` on the region until it is finished loading. |
| 114 |
|
| 115 |
Note: A [live region](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions) must be present before changing its status in order for the change to be read. |
| 116 |
|
| 117 |
### Usage |
| 118 |
|
| 119 |
| Class | Applied to | Outcome | |
| 120 |
| -- | -- | -- | |
| 121 |
| `.pf-v6-c-spinner` | `<svg>` | Creates a spinner component. The default is an extra large spinner. **Required**| |
| 122 |
| `.pf-v6-c-spinner__path` | `<circle>` | Creates a spinner circle component. **Required**| |
| 123 |
| `--pf-v6-c-spinner--diameter` | `.pf-v6-c-spinner` | Modifies the value for `--pf-v6-c-spinner--diameter` declaration. | |
| 124 |
|
| 125 |
### Modifiers |
| 126 |
|
| 127 |
| Class | Applied to | Outcome | |
| 128 |
| -- | -- | -- | |
| 129 |
| `.pf-m-xs` | `.pf-v6-c-spinner` | Creates a extra-small spinner. | |
| 130 |
| `.pf-m-sm` | `.pf-v6-c-spinner` | Creates a small spinner. | |
| 131 |
| `.pf-m-md` | `.pf-v6-c-spinner` | Creates a medium spinner. | |
| 132 |
| `.pf-m-lg` | `.pf-v6-c-spinner` | Creates a large spinner. | |
| 133 |
| `.pf-m-xl` | `.pf-v6-c-spinner` | Creates an extra-large spinner. | |
| 134 |
| `.pf-m-inline` | `.pf-v6-c-spinner` | Creates an inline spinner. | |