|
| 1 | +--- |
| 2 | +layout: page |
| 3 | +title: Skeleton |
| 4 | +description: A skeleton component is used to indicate that a large block of content, such as an AI responses or post summary, is loading. |
| 5 | +--- |
| 6 | + |
| 7 | +<section class="stacks-section"> |
| 8 | + {% header "h2", "Classes" %} |
| 9 | + <div class="overflow-x-auto mb32" tabindex="0"> |
| 10 | + <table class="wmn4 s-table s-table__bx-simple"> |
| 11 | + <thead> |
| 12 | + <tr> |
| 13 | + <th scope="col">Class</th> |
| 14 | + <th scope="col">Applied to</th> |
| 15 | + <th scope="col">Description</th> |
| 16 | + </tr> |
| 17 | + </thead> |
| 18 | + <tbody class="fs-caption"> |
| 19 | + {% for item in skeleton.skeleton %} |
| 20 | + <tr> |
| 21 | + <td><code class="stacks-code ws-nowrap">{{ item.class }}</code></td> |
| 22 | + <td>{% if item.applies == "N/A" %}<em class="fc-black-350">{{ item.applies }}</em>{% else %}<code class="stacks-code">{{ item.applies }}</code>{% endif %}</td> |
| 23 | + <td>{{ item.description }}</td> |
| 24 | + </tr> |
| 25 | + {% endfor %} |
| 26 | + </tbody> |
| 27 | + </table> |
| 28 | + </div> |
| 29 | +</section> |
| 30 | + |
| 31 | +<section class="stacks-section"> |
| 32 | + {% header "h2", "Examples" %} |
| 33 | + {% header "h3", "Base style" %} |
| 34 | + <p class="stacks-copy">The default skeleton should be used when loading large blocks will render multiple rows of content.</p> |
| 35 | + <div class="stacks-preview"> |
| 36 | +{% highlight html %} |
| 37 | +<div class="s-skeleton"> |
| 38 | + <div class="v-visible-sr">Loading…</div> |
| 39 | +</div> |
| 40 | +{% endhighlight %} |
| 41 | + <div class="stacks-preview--example"> |
| 42 | + <div class="s-skeleton"> |
| 43 | + <div class="v-visible-sr">Loading…</div> |
| 44 | + </div> |
| 45 | + </div> |
| 46 | + </div> |
| 47 | + |
| 48 | + {% header "h3", "AI" %} |
| 49 | + <p class="stacks-copy">The <code class="stacks-code">ai</code> variant of the skeleton should be used when loading AI responses.</p> |
| 50 | + <div class="stacks-preview"> |
| 51 | +{% highlight html %} |
| 52 | +<div class="s-skeleton s-skeleton__ai"> |
| 53 | + <div class="v-visible-sr">Loading…</div> |
| 54 | +</div> |
| 55 | +{% endhighlight %} |
| 56 | + <div class="stacks-preview--example"> |
| 57 | + <div class="s-skeleton s-skeleton__ai"> |
| 58 | + <div class="v-visible-sr">Loading…</div> |
| 59 | + </div> |
| 60 | + </div> |
| 61 | + </div> |
| 62 | +</section> |
| 63 | + |
| 64 | +<section class="stacks-section"> |
| 65 | + {% header "h2", "Accessibility" %} |
| 66 | + <p class="stacks-copy">For accessibility, it’s important to add fallback loading text that is visible to screen readers. Additionally, you should add <code class="stacks-code">aria-busy="true"</code> to the component that triggered the loading state while the skeleton is shown.</p> |
| 67 | +</section> |
| 68 | + |
0 commit comments