|
| 1 | +<!-- |
| 2 | +The index.md file is a compiled document. No edits should be made directly to this file. |
| 3 | +README.md is created by running `npm run build:docs`. |
| 4 | +This file is generated based on a template fetched from `./docs/partials/index.md` |
| 5 | +--> |
| 6 | + |
| 7 | +# Skeleton |
| 8 | + |
| 9 | +<!-- AURO-GENERATED-CONTENT:START (FILE:src=../docs/partials/description.md) --> |
| 10 | +<!-- The below content is automatically added from ../docs/partials/description.md --> |
| 11 | +The `<auro-skeleton>` custom element is for use when display content takes an extended amount of time to process and render on-screen. This indicator communicates to the user that data is being loaded and that the page is not frozen. |
| 12 | + |
| 13 | +[Research](https://www.nngroup.com/articles/progress-indicators/) conducted by the Nielsen Norman Group states that using skeleton states and [loading indicators](https://auro.alaskaair.com/components/auro/loader) improve user satisfaction. |
| 14 | + |
| 15 | +The `<auro-skeleton>` element uses animation to convey that the page is still loading in order to reduce user uncertainty. |
| 16 | +<!-- AURO-GENERATED-CONTENT:END --> |
| 17 | + |
| 18 | +## auro-skeleton use cases |
| 19 | + |
| 20 | +<!-- AURO-GENERATED-CONTENT:START (FILE:src=../docs/partials/useCases.md) --> |
| 21 | +<!-- The below content is automatically added from ../docs/partials/useCases.md --> |
| 22 | +The `<auro-skeleton>` element can be used on container-based components like `<auro-card>` and other structured lists. |
| 23 | +<!-- AURO-GENERATED-CONTENT:END --> |
| 24 | + |
| 25 | +## Do not... |
| 26 | + |
| 27 | +`<auro-skeleton>` should not be used on action components like `<auro-button>`, `<auro-input>` or `<auro-radio>`. |
| 28 | + |
| 29 | +Do not represent a loading state with `<auro-skeleton>` for an entire component such as a toast notification, dropdown menus, or a modal dialog. It is appropriate to use `<auro-skeleton>` for content inside those components, but never for the entire component. |
| 30 | + |
| 31 | +## Default examples |
| 32 | + |
| 33 | +The `<auro-skeleton>` API consists of a standardized enumerated `shape` attribute and the use of customized CSS. The following examples illustrate use cases to include `circle`, `oval` and `rectangle`. With the use of CSS the user has infinite options for how the animated skeleton can be used in their loading UI. |
| 34 | + |
| 35 | +<div class="exampleWrapper"> |
| 36 | + <!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/basic.html) --> |
| 37 | + <!-- The below content is automatically added from ../apiExamples/basic.html --> |
| 38 | + <auro-skeleton shape="circle" style="width: 40px; height: 40px"></auro-skeleton> |
| 39 | + <auro-skeleton shape="oval" style="width: 200px; height: 100px;"></auro-skeleton> |
| 40 | + <auro-skeleton shape="rectangle" style="width: 400px; height: 300px"></auro-skeleton> |
| 41 | + <!-- AURO-GENERATED-CONTENT:END --> |
| 42 | +</div> |
| 43 | +<auro-accordion alignRight> |
| 44 | + <span slot="trigger">See code</span> |
| 45 | +<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/basic.html) --> |
| 46 | +<!-- The below code snippet is automatically added from ../apiExamples/basic.html --> |
| 47 | + |
| 48 | +```html |
| 49 | +<auro-skeleton shape="circle" style="width: 40px; height: 40px"></auro-skeleton> |
| 50 | +<auro-skeleton shape="oval" style="width: 200px; height: 100px;"></auro-skeleton> |
| 51 | +<auro-skeleton shape="rectangle" style="width: 400px; height: 300px"></auro-skeleton> |
| 52 | +``` |
| 53 | +<!-- AURO-GENERATED-CONTENT:END --> |
| 54 | +</auro-accordion> |
| 55 | + |
| 56 | +## Be creative |
| 57 | + |
| 58 | +Use your imagination. Wherever data can be placed, an `<auro-skeleton>` element can be used. In the following example see how `<auro-skeleton>` is used in place where data will be filled once the process is completed. |
| 59 | + |
| 60 | +<div class="exampleWrapper"> |
| 61 | + <!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/table_example.html) --> |
| 62 | + <!-- The below content is automatically added from ../apiExamples/table_example.html --> |
| 63 | + <table class="auro_table"> |
| 64 | + <thead> |
| 65 | + <tr> |
| 66 | + <th>The table header</th> |
| 67 | + <th>The table header</th> |
| 68 | + </tr> |
| 69 | + </thead> |
| 70 | + <tbody> |
| 71 | + <tr> |
| 72 | + <td colspan="2"> |
| 73 | + <auro-skeleton shape="oval" style="height: 20px;"></auro-skeleton> |
| 74 | + </td> |
| 75 | + </tr> |
| 76 | + <tr> |
| 77 | + <td colspan="2"> |
| 78 | + <auro-skeleton shape="oval" style="height: 20px;"></auro-skeleton> |
| 79 | + </td> |
| 80 | + </tr> |
| 81 | + <tr> |
| 82 | + <td colspan="2"> |
| 83 | + <auro-skeleton shape="oval" style="height: 20px;"></auro-skeleton> |
| 84 | + </td> |
| 85 | + </tr> |
| 86 | + </tbody> |
| 87 | + </table> |
| 88 | + <!-- AURO-GENERATED-CONTENT:END --> |
| 89 | +</div> |
| 90 | +<auro-accordion alignRight> |
| 91 | + <span slot="trigger">See code</span> |
| 92 | +<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/table_example.html) --> |
| 93 | +<!-- The below code snippet is automatically added from ../apiExamples/table_example.html --> |
| 94 | + |
| 95 | +```html |
| 96 | +<table class="auro_table"> |
| 97 | + <thead> |
| 98 | + <tr> |
| 99 | + <th>The table header</th> |
| 100 | + <th>The table header</th> |
| 101 | + </tr> |
| 102 | + </thead> |
| 103 | + <tbody> |
| 104 | + <tr> |
| 105 | + <td colspan="2"> |
| 106 | + <auro-skeleton shape="oval" style="height: 20px;"></auro-skeleton> |
| 107 | + </td> |
| 108 | + </tr> |
| 109 | + <tr> |
| 110 | + <td colspan="2"> |
| 111 | + <auro-skeleton shape="oval" style="height: 20px;"></auro-skeleton> |
| 112 | + </td> |
| 113 | + </tr> |
| 114 | + <tr> |
| 115 | + <td colspan="2"> |
| 116 | + <auro-skeleton shape="oval" style="height: 20px;"></auro-skeleton> |
| 117 | + </td> |
| 118 | + </tr> |
| 119 | + </tbody> |
| 120 | +</table> |
| 121 | +``` |
| 122 | +<!-- AURO-GENERATED-CONTENT:END --> |
| 123 | +</auro-accordion> |
| 124 | + |
| 125 | +## Recommended Use and Version Control |
| 126 | + |
| 127 | +There are two important parts of every Auro component. The <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes">class</a> and the custom element. The class is exported and then used as part of defining the Web Component. When importing this component as described in the <a href="#install">install</a> section, the class is imported and the `auro-skeleton` custom element is defined automatically. |
| 128 | + |
| 129 | +To protect from versioning conflicts with other instances of the component being loaded, it is recommended to use our `AuroSkeleton.register(name)` method and pass in a unique name. |
| 130 | + |
| 131 | +```js |
| 132 | +import { AuroSkeleton } from './src/auro-skeleton.js'; |
| 133 | + |
| 134 | +AuroSkeleton.register('custom-skeleton'); |
| 135 | +``` |
| 136 | + |
| 137 | +This will create a new custom element that you can use in your HTML that will function identically to the `<auro-skeleton>` element. |
| 138 | + |
| 139 | +<div class="exampleWrapper exampleWrapper--flex"> |
| 140 | + <!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/custom.html) --> |
| 141 | + <!-- The below content is automatically added from ../apiExamples/custom.html --> |
| 142 | + <custom-skeleton shape="circle" style="width: 40px; height: 40px"></custom-skeleton> |
| 143 | + <custom-skeleton shape="oval" style="width: 200px; height: 100px;"></custom-skeleton> |
| 144 | + <custom-skeleton shape="rectangle" style="width: 400px; height: 300px"></custom-skeleton> |
| 145 | + <!-- AURO-GENERATED-CONTENT:END --> |
| 146 | +</div> |
| 147 | +<auro-accordion alignRight> |
| 148 | + <span slot="trigger">See code</span> |
| 149 | +<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/custom.html) --> |
| 150 | +<!-- The below code snippet is automatically added from ../apiExamples/custom.html --> |
| 151 | + |
| 152 | +```html |
| 153 | +<custom-skeleton shape="circle" style="width: 40px; height: 40px"></custom-skeleton> |
| 154 | +<custom-skeleton shape="oval" style="width: 200px; height: 100px;"></custom-skeleton> |
| 155 | +<custom-skeleton shape="rectangle" style="width: 400px; height: 300px"></custom-skeleton> |
| 156 | +``` |
| 157 | +<!-- AURO-GENERATED-CONTENT:END --> |
| 158 | +</auro-accordion> |
0 commit comments