Skip to content

Skeleton ​

A placeholder for when the data is not loaded yet; the real content is rendered when loading is false.

Basic usage ​

vue
<template>
  <lh-skeleton :loading="loading">
    <view>Real content</view>
  </lh-skeleton>
</template>

<script setup lang="ts">
import { ref } from 'vue'
const loading = ref(true)
</script>

Rows and avatar ​

vue
<template>
  <lh-skeleton :loading="true" :rows="4" avatar />
</template>

Disabling the animation ​

vue
<template>
  <lh-skeleton :loading="true" :animated="false" :rows="3" />
</template>

Standalone placeholder blocks ​

lh-skeleton-item can be used on its own to assemble a custom placeholder layout; variant takes text / rect / circle.

vue
<template>
  <view class="custom-skeleton">
    <lh-skeleton-item variant="circle" class="avatar" />
    <lh-skeleton-item variant="text" class="line" />
  </view>
</template>

Props (lh-skeleton) ​

PropDescriptionTypeDefault
loadingWhether it is in the loading state (when false, the real content of the default slot is rendered)booleantrue
rowsNumber of text rowsnumber3
avatarWhether to include a circular avatar placeholderbooleanfalse
animatedWhether the animation is enabledbooleantrue
customClassCustom class namestring—
sxQuick layout propsLhSxProps—

Props (lh-skeleton-item) ​

PropDescriptionTypeDefault
variantPlaceholder block shape'text' | 'rect' | 'circle''text'
animatedWhether the animation is enabledbooleantrue
customClassCustom class namestring—
sxQuick layout propsLhSxProps—

Slots (lh-skeleton) ​

SlotDescription
defaultThe real content rendered when loading is false

Accessibility

The container is labeled with aria-busy="true" and aria-live="polite", and the placeholder blocks themselves are hidden from assistive technologies; once the data is ready, screen readers announce the real content automatically.