1.0.0 • Published 9 months ago

v3-skeleton v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Vue3 Skeleton

Vue3Skeleton is a Vue 3 component designed to display a skeleton loading animation while content is being loaded. You can use it to improve the user experience while the main content or data is still loading.

Installation

First, install the package using npm or yarn:

npm install v3-skeleton

or

yarn add v3-skeleton

Basic Usage

Here’s an example of how to use the Vue3Skeleton component in your project:

<template>
  <Vue3Skeleton :loading="true" width="100%" height="20px">
    <template #default>
      <!-- Content to show when not loading -->
      <p>Loaded content</p>
    </template>
  </Vue3Skeleton>
</template>

<script setup>
import Vue3Skeleton from 'v3-skeleton';
</script>

See the a example project here.

Props

PropTypeDefault ValueDescription
asString'div'The HTML tag used to wrap the skeleton. You can change it to any valid tag.
loadingBooleanfalseIf true, shows the skeleton, otherwise shows the slotted content.
widthString'100%'The width of the skeleton. Any valid CSS width value is accepted.
heightString'20px'The height of the skeleton. Any valid CSS height value is accepted.
borderRadiusString'4px'The border-radius of the skeleton element.
backgroundColorString'#e0e0e0'The primary background color of the skeleton.
toColorString'#f0f0f0'The secondary color for the skeleton animation gradient.
intervalString'3s'The animation duration for the skeleton. You can use any valid duration.

Slots

  • default: The content to be displayed when loading is false.

Custom Styles

You can adjust the visual behavior of the skeleton via the props such as width, height, backgroundColor, borderRadius, etc.

Additionally, you can override the style in your own CSS file to fit the specific needs of your application:

.skeleton {
  width: 200px;
  height: 40px;
  background-color: #ccc;
  border-radius: 8px;
}

Animation

The animation is configurable using the interval prop, which adjusts the animation cycle duration. If you want to modify more aspects of the animation, you can do so via direct CSS styling.

Contribution

If you find any issues or would like to contribute to the project, feel free to open an issue or submit a pull request.


Thank you for using Vue3Skeleton!

1.0.0

9 months ago

0.0.6

9 months ago

0.0.5

9 months ago

0.0.4

9 months ago

0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

9 months ago