Skeleton
Alignment target:@astryxdesign/core v0.7.1 · Skeleton
Usage #
Import the component from its dedicated entry. The component loads its structural styles.
Import the theme in your application entry:
TypeScript
import '@astryx-vue/themes/neutral.css'Component usage:
Vue
<script setup lang="ts">
import { Skeleton } from '@astryx-vue/core/Skeleton'
</script>
<template>
<div aria-busy="true" aria-label="Loading content" role="status">
<Skeleton :height="20" :width="200" />
</div>
</template>Anatomy
| Element | Description |
|---|---|
| Placeholder | Painted shape that stands in for content while it loads. |
Best practices #
| Guidance | Practices |
|---|---|
| Do | Match the size and shape of the content being loaded to create a realistic placeholder. |
| Do | Stagger multiple skeletons with the index prop for a natural wave animation. |
| Don't | Use when the content dimensions are unknown; use Spinner instead. |
| Don't | Combine with a Spinner on the same content area; pick one loading pattern. |
| Don't | Show skeletons indefinitely; if loading takes too long, show an error or empty state instead. |
Examples #
Skeleton — Card loading
A card placeholder: a round avatar, a name, a short line, then a few lines of body text. index staggers the pulse.
Skeleton — Staggered list
Horizontal bars of different widths, standing in for a list that has not loaded yet.
Skeleton — Table rows
Four columns per row, with widths that follow the content, and a pulse that steps forward by index.