Gathering detailed insights and metrics for vue-content-loader
Gathering detailed insights and metrics for vue-content-loader
Gathering detailed insights and metrics for vue-content-loader
Gathering detailed insights and metrics for vue-content-loader
npm install vue-content-loader
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
3,049 Stars
277 Commits
137 Forks
26 Watching
11 Branches
7 Contributors
Updated on 26 Nov 2024
JavaScript (56.83%)
TypeScript (32.39%)
Vue (10.78%)
Cumulative downloads
Total Downloads
Last day
2.1%
5,560
Compared to previous day
Last week
7.2%
29,091
Compared to previous week
Last month
13.2%
118,854
Compared to previous month
Last year
-10.1%
1,297,924
Compared to previous year
SVG component to create placeholder loading, like Facebook cards loading.
This is a Vue port for react-content-loader.
⚠️ The latest version is compatible with Vue 3 only. For Vue 2 & Nuxt 2, use vue-content-loader@^0.2
instead.
With npm:
1npm i vue-content-loader
Or with yarn:
1yarn add vue-content-loader
CDN: UNPKG | jsDelivr (available as window.contentLoaders
)
👀👉 Demo: CodeSandbox
1<template> 2 <content-loader></content-loader> 3</template> 4 5<script> 6import { ContentLoader } from 'vue-content-loader' 7 8export default { 9 components: { 10 ContentLoader, 11 }, 12} 13</script>
1import { 2 ContentLoader, 3 FacebookLoader, 4 CodeLoader, 5 BulletListLoader, 6 InstagramLoader, 7 ListLoader, 8} from 'vue-content-loader'
ContentLoader
is a meta loader while other loaders are just higher-order components of it. By default ContentLoader
only displays a simple rectangle, here's how you can use it to create custom loaders:
1<ContentLoader viewBox="0 0 250 110"> 2 <rect x="0" y="0" rx="3" ry="3" width="250" height="10" /> 3 <rect x="20" y="20" rx="3" ry="3" width="220" height="10" /> 4 <rect x="20" y="40" rx="3" ry="3" width="170" height="10" /> 5 <rect x="0" y="60" rx="3" ry="3" width="250" height="10" /> 6 <rect x="20" y="80" rx="3" ry="3" width="200" height="10" /> 7 <rect x="20" y="100" rx="3" ry="3" width="80" height="10" /> 8</ContentLoader>
This is also how ListLoader is created.
You can also use the online tool to create shapes for your custom loader.
Prop | Type | Default | Description |
---|---|---|---|
width | number, string | SVG width in pixels without unit | |
height | number, string | SVG height in pixels without unit | |
viewBox | string | '0 0 ${width ?? 400} ${height ?? 130}' | See SVG viewBox attribute |
preserveAspectRatio | string | 'xMidYMid meet' | See SVG preserveAspectRatio attribute |
speed | number | 2 | Animation speed |
primaryColor | string | '#f9f9f9' | Background color |
secondaryColor | string | '#ecebeb' | Highlight color |
uniqueKey | string | randomId() | Unique ID, you need to make it consistent for SSR |
animate | boolean | true | |
baseUrl | string | empty string | Required if you're using <base url="/" /> in your <head /> . Defaults to an empty string. This prop is common used as: <content-loader :base-url="$route.fullPath" /> which will fill the SVG attribute with the relative path. Related #14. |
primaryOpacity | number | 1 | Background opacity (0 = transparent, 1 = opaque) used to solve an issue in Safari |
secondaryOpacity | number | 1 | Background opacity (0 = transparent, 1 = opaque) used to solve an issue in Safari |
To create a responsive loader that will follow its parent container width, use only the viewBox
attribute to set the ratio:
1<ContentLoader viewBox="0 0 300 200"> 2 <!-- ... --> 3</ContentLoader>
To create a loader with fixed dimensions, use width
and height
attributes:
1<ContentLoader width="300" height="200"> 2 <!-- ... --> 3</ContentLoader>
Note: the exact behavior might be different depending on the CSS you apply to SVG elements.
This is basically a Vue port for react-content-loader.
Thanks to @alidcastano for transferring the package name to me. 😘
MIT © EGOIST
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 0/16 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
56 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More