The Ultimate fully-customizable skeleton cards plugin for Vue
npm install vue-ultimate-skeleton-cards
Bison
yarn add vue-ultimate-skeleton-cards
or
npm install vue-ultimate-skeleton-cards
`
Usage
In main.js add the following along with other imports:
`js
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:
`vue
`
or
`vue
//Your custom layout
`
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.
$3
Note: Animations can't play in this file. Check out the guide for a working demo.
`vue
`
`vue
`
$3
| Prop name | Type | Description | Default |
| ------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------ | ----------- |
| primary | String | Primary color of your card | #242424 |
| padding | String | Padding | 2em 3em |
| borderRadius | String | Border radius of the card rounded by default | 20px |
| contrast | Number | Contrast between the card color and color of the inner blocks | 10 |
| animDisable | Boolean | Disable the animation or not | false |
| animDuration | String | Animation duration | 1.5s |
| animTimingFunction | String | Timing function for the animation with a bezier curve or the predefined css ease, ease-in, ease-out, ease-in-out | CSS default |
| structure | String | Define your structure with a string of numbers | 1120333304 |
$3
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:
| Number | Corresponds to | Properties |
| ------ | -------------- | ---------- |
| 7 | Card Image (Pinned to the top) | Always add in the beginning of the prop's string and only _once_ |
| 0 | Break line | Breaks or adds new line. Useful for spacing |
| 1 | Box Type 1 | Suitable for Titles
Height: 1.5em
Width: 90%
Color: Darker by 10 or 20 points depending on contrast |
| 2 | Box Type 2 | Suitable for Subtitles
Height: 1.3em
Width: 70%
Color: Darker by 3 or 10 points depending on contrast |
| 3 | Box Type 3 | Suitable for General content
Height: 1.1em
Width: 50%-90% (Random)
Color: Darker or Lighter by 10 points depending on contrast |
| 4 | Rounded Button | Border-radius: 20px |
| 5 | Rectangular Button | Border-radius: 0px |
| 6 | Circle | Suitable 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 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.
$3
`vue
`
$3
SkeletonScaffold takes almost the same props as the SkeletonCard component except that it doesn't have the structure and contrast prop.
$3
| Prop name | Type | Description | Default |
| ------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------ | ----------- |
| primary | String | Primary color of your card | #242424 |
| padding | String | Padding | "2em 3em" |
| borderRadius | String | Border radius of the card rounded by default | 20px |
| animDisable | Boolean | Disable the animation or not | false |
| animDuration | String | Animation duration | 1.5s |
| animTimingFunction | String | Timing function for the animation with a bezier curve or the predefined css ease, ease-in, ease-out, ease-in-out | CSS 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:
$3
| Vue Directive | Properties | Default Color | Default Dimensions (Width, Height) |
| ------------- | ---------- | ------------- | ---------------------------------- |
| v-mBox | Simple box useful for text content like title, subtitle or general content | Darker than parent by 3 points | 100%, 1.1em
| v-mSquare | Square. Useful for profile images. Can be rounded to make a circle | Darker than parent by 10 points | 3em, 3em
| v-mButton | Button | Darker than parent by 5 points | 5em, 2em
| v-mCardImg | Pins to the top. Big square for main image in a vertical card. | Darker than parent by 10 points | 100%, 10em
Moreover, mBox and mSquare have default bottom margin of 0.5em`
Made with :heart: by Neelansh Mathur