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

ElementDescription
PlaceholderPainted shape that stands in for content while it loads.

Best practices #

GuidancePractices
DoMatch the size and shape of the content being loaded to create a realistic placeholder.
DoStagger multiple skeletons with the index prop for a natural wave animation.
Don'tUse when the content dimensions are unknown; use Spinner instead.
Don'tCombine with a Spinner on the same content area; pick one loading pattern.
Don'tShow skeletons indefinitely; if loading takes too long, show an error or empty state instead.

Examples #

Skeleton — Card loading

Open in Playground

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

Open in Playground

Horizontal bars of different widths, standing in for a list that has not loaded yet.

Skeleton — Table rows

Open in Playground

Four columns per row, with widths that follow the content, and a pulse that steps forward by index.