Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue4-skeleton-loader

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue4-skeleton-loader

Creating a loading animated and attractive skeleton

  • 0.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-50%
Maintainers
0
Weekly downloads
 
Created
Source

Vue3 Skeleton Loader

Creating a loading animation with an attractive appearance and in line with the app design, for a pleasant user experience.

Animated GIF

Basic Usage

Using npm

npm install vue3-skeleton-loader

Using yarn

yarn add vue3-skeleton-loader

Using loader in your .vue file

import VueSkeletonLoader from 'vue3-skeleton-loader';
import 'vue3-skeleton-loader/dist/style.css';

<VueSkeletonLoader type="image@2"></VueSkeletonLoader>

Introduction

Skeleton loader provides a simple solution to provide loading variables in your application.
It prepares the user for content while data is fetched from the server or loaded asynchronously.

Props

Skeleton

PropValuesDefaultType
loadingtrue, falsetrueBoolean
If true, the skeleton loader will be displayed.
typetext, avatar, image, button, chip, dividertextString
Specifies the type and number of your skeleton, e.g., text@4. If only the type is written, it defaults to one.
animationwavewaveString
If left empty, no animation will be displayed. To showcase a specific animation, provide its name and define the corresponding keyframes globally.
duration-1.5sString
The duration of the animation.
timingFunctionCommon values include: ease, linear, ease-in, ease-out, ease-in-out, ...linearString
Specifies the speed curve of the animation.
base-color-#0000001EString
Background color of the skeleton.
highlight-color-#FFFFFF66String
Highlight color in the skeleton animation.
border-radius-variesString, Number
Border radius of the skeleton, varies by type.
height-variesString, Number
Height of the skeleton, varies by type.
width-variesString, Number
Width of the skeleton, varies by type.
directionltrltr, rtlString
Direction of the animation.
skeleton-style-{}Object
Custom style for individual skeleton elements.
skeleton-class-name-""String
Custom class name for individual skeleton elements, used alongside default class names.

Examples

Custom animation

To set a custom animation for the VueSkeletonLoader, first, register the animation globally, then pass its name to the component using the animation prop.

Troubleshooting

Skeleton gets width 0 when parent display is flex

In the example below, the issue is demonstrated. To resolve it, you can either set the style flex:1 for VueSkeletonLoader or enclose the skeleton within a div element, as shown below:


<script setup lang="ts">
  import VueSkeletonLoader from 'vue3-skeleton-loader';
  import 'vue3-skeleton-loader/dist/style.css';
</script>
<template>
  <div class="container">
    <div class="avatar-container">
      <VueSkeletonLoader type="avatar"/>
      <div>
        <VueSkeletonLoader type="text" width="100px" height="10px"/>
        <VueSkeletonLoader type="text" width="70px" height="6px"/>
      </div>
    </div>
  </div>
</template>

<style lang="scss">
  .container {
    max-width: 400px;
    margin: 30px auto;
    padding: 12px;
    border: 2px solid #0000001E;
    border-radius: 0.25rem;

    .avatar-container {
      display: flex;
      gap: 12px;
      align-items: center;
    }
  }

</style>

License

MIT

Keywords

FAQs

Package last updated on 09 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc