You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

vue-ultimate-skeleton-cards

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-ultimate-skeleton-cards

The Ultimate fully-customizable skeleton cards plugin for Vue

1.0.3
latest
Source
npm
Version published
Maintainers
1
Created
Source

Vue Ultimate Skeleton Cards

Check out the guide and demo for full information. This is just an overview.

Vue Ultimate Skeleton Cards (Or VUSC for short) is a cool customizable skeleton card plugin for VueJS.
It gives you two ways of defining a skeleton card that suits your needs.

New loading animation

The cards have a unique loading animation which is different from the legacy skeleton cards you have seen till now.
There is more eye-catching movement in these cards to captivate your viewers.

Installation

Run either one in your Vue directory:

yarn add vue-ultimate-skeleton-cards
or
npm install vue-ultimate-skeleton-cards

Usage

In main.js add the following along with other imports:

import SkeletonCards from 'vue-ultimate-skeleton-cards'
Vue.use(SkeletonCards)

The name with which you import doesn't matter.

In your component template, you can use any of the two components without registering them:

<SkeletonCard />

or

<SkeletonScaffold>
//Your custom layout
</SkeletonScaffold>

There are two globally available components for you to use:

  • SkeletonCard - Quickly create a card and define its structure with just a small string of numbers
  • SkeletonScaffold - Full control over the card's layout with custom Vue directives and your own basic CSS

SkeletonCard

This is the easist to get started with. It provides by default a dark mode Skeleton Card for which you can customize various properties like color, animation, structure, etc.

Examples

Note: Animations can't play in this file. Check out the guide for a working demo.

<SkeletonCard />
<SkeletonCard primary="#112233" structure="701120333" animDisable />

SkeletonCard Props List

Prop nameTypeDescriptionDefault
primaryStringPrimary color of your card#242424
paddingStringPadding2em 3em
borderRadiusStringBorder radius of the card rounded by default20px
contrastNumberContrast between the card color and color of the inner blocks10
animDisableBooleanDisable the animation or notfalse
animDurationStringAnimation duration1.5s
animTimingFunctionStringTiming function for the animation with a bezier curve or the predefined css ease, ease-in, ease-out, ease-in-outCSS default
structureStringDefine your structure with a string of numbers1120333304

The Structure prop

The structure prop is a unique and super-easy way to define a basic vertical structure with a string of numbers each corresponding to a specific element type (for example a profile logo or header bar).

Here is the mapping of the numbers:

NumberCorresponds toProperties
7Card Image (Pinned to the top)Always add in the beginning of the prop's string and only once
0<br /> Break lineBreaks or adds new line. Useful for spacing
1Box Type 1Suitable for Titles
Height: 1.5em
Width: 90%
Color: Darker by 10 or 20 points depending on contrast
2Box Type 2Suitable for Subtitles
Height: 1.3em
Width: 70%
Color: Darker by 3 or 10 points depending on contrast
3Box Type 3Suitable for General content
Height: 1.1em
Width: 50%-90% (Random)
Color: Darker or Lighter by 10 points depending on contrast
4Rounded ButtonBorder-radius: 20px
5Rectangular ButtonBorder-radius: 0px
6CircleSuitable for profile images in skeleton card
Border-radius: 100%

SkeletonScaffold

This component gives you full control over the layout of your skeleton card. It does so by providing global Vue directives which you can use with <div /> tags inside of the SkeletonScaffold component to generate the required boxes, circles, etc.

The colors of the generated elements will derive from the SkeletonScaffold component's primary prop. So setting the color once in the component will reflect on all the child components (See table below). To make the elements lighter or darker than the parent, use the v-mLight and v-mDark directives.

This way of scaffolding with vue directives is especially useful as you can use CSS to make this in any way you want, including using CSS Grids to get a proper layout in place.

Example

<SkeletonScaffold primary="purple" animDisable>
    <div v-mCardImg></div> <!-- Card Image -->
    <br />
    
    <div v-mSquare style="border-radius: 100%"></div> <!-- Profile image -->
    <br />

    <div v-mBox v-mDark style="height: 1.5em"></div> <!-- Heading -->
    <div v-mBox v-mDark style="height: 1.5em"></div> <!-- Heading -->
    <div v-mBox style="height: 1.3em; width: 60%"></div> <!-- Sub-Heading -->
    <br />

    <!-- Content Boxes -->
    <div v-mBox v-mLight v-mRandomWidth></div>
    <div v-mBox v-mLight v-mRandomWidth></div>
    <div v-mBox v-mLight v-mRandomWidth></div>
    <div v-mBox v-mLight v-mRandomWidth></div>
    <br />

    <!-- Default Rectangular Button -->
    <div v-mButton></div>
</SkeletonScaffold>

SkeletonScaffold Props List

SkeletonScaffold takes almost the same props as the SkeletonCard component except that it doesn't have the structure and contrast prop.

SkeletonScaffold Props

Prop nameTypeDescriptionDefault
primaryStringPrimary color of your card#242424
paddingStringPadding"2em 3em"
borderRadiusStringBorder radius of the card rounded by default20px
animDisableBooleanDisable the animation or notfalse
animDurationStringAnimation duration1.5s
animTimingFunctionStringTiming function for the animation with a bezier curve or the predefined css ease, ease-in, ease-out, ease-in-outCSS default

For the structure itself, use the pre-defined global directives below inside the component.
Here is the list of global directives available for use with div elements:

Base Directives

Vue DirectivePropertiesDefault ColorDefault Dimensions (Width, Height)
v-mBoxSimple box useful for text content like title, subtitle or general contentDarker than parent by 3 points100%, 1.1em
v-mSquareSquare. Useful for profile images. Can be rounded to make a circleDarker than parent by 10 points3em, 3em
v-mButtonButtonDarker than parent by 5 points5em, 2em
v-mCardImgPins to the top. Big square for main image in a vertical card.Darker than parent by 10 points100%, 10em

Moreover, mBox and mSquare have default bottom margin of 0.5em

Utility Directives

Vue DirectiveProperty
v-mLightLighten element by 10 points*
v-mDarkDarken element by 10 points*
v-mRandomWidthAssign a random width between 50%-90%

* = With reference to parent element's color

Contributing

Contributions in the form of issues / pull requests are welcome. If you wish to discuss something with me, hit me up on twitter :smiley:

Reach out

Github: @neelansh15
Twitter: @mneelansh15
LinkedIn: neelanshmathur

Made with :heart: by Neelansh Mathur

Keywords

skeleton card

FAQs

Package last updated on 09 Sep 2020

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