Vue Loading Skeleton is a component library designed for Vue 2 applications, specifically requiring `vue: ^2.6.11`. It offers a streamlined approach to creating animated loading skeleton screens. A key differentiator of this library is its `Skeleton` component's ability to automatically adapt to the dimensions and typography of the actual content it will eventually replace. This eliminates the manual effort often required to perfectly match font-sizes, margins, or line heights, as it intelligently derives these styles from the wrapped content's first child node. The library also includes a `SkeletonTheme` component, allowing developers to apply global styling parameters like color and animation duration across multiple `Skeleton` instances. The current stable version is 1.1.9, with its last major update occurring approximately six years ago. This indicates that the project is in a maintenance phase, primarily supporting its existing Vue 2 user base, rather than active development with new features. For Vue 3 projects, users should seek out more recently developed, Vue 3-compatible skeleton loading libraries.
npm install vue-loading-skeletonVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to integrate `vue-loading-skeleton` into a Vue 2 application, showing a `Skeleton` component while data is being fetched and then rendering the actual content. It also uses `SkeletonTheme` to apply a consistent animation style.
For Vue 3 projects, consider using dedicated Vue 3 skeleton loading libraries such as `vue3-loading-skeleton`, `vue-skeletor`, or `@brayamvalero/vue3-skeleton`.
Wrap your content in a single root element (e.g., a `<div>` or specific semantic tag) within the `Skeleton` component if auto-adaptation is misbehaving. Alternatively, use `v-if` to conditionally render `Skeleton` or the actual content, or directly pass `height` and `width` props to `Skeleton` for explicit control.
For new Vue 2 projects, this library is still a viable option. However, for long-term projects or those considering migrating to Vue 3, plan for a transition to a more actively maintained skeleton library.
Ensure you `import { Skeleton, SkeletonTheme } from 'vue-loading-skeleton'` in your script and include `Skeleton` and `SkeletonTheme` in the `components: { ... }` object of your Vue component.This library is for Vue 2 only. If you are using Vue 3, you must use a Vue 3-compatible skeleton loading library.
Either adjust the content structure to ensure a single, representative first child node, or explicitly control the `Skeleton`'s visibility using `v-if` based on a `loading` state, or provide `width` and `height` props to the `Skeleton` component directly.