nb-skeleton
This is a skeleton loader component for Vue.js 3+.
Loading component...
Installation
Yarn
yarn add @vlalg-nimbus/nb-loaders
Usage
Vue 3
import { createApp } from 'vue'
import App from './App.vue'
import NbLoadersComponents from '@vlalg-nimbus/nb-loaders'
import "@vlalg-nimbus/nb-loaders/dist/style.css";
const app = createApp(App)
app.use(NbLoadersComponents)
app.mount('#app')
To use, simply call the component, in this case it will be NbSkeleton or nb-skeleton.
Important: The
NbSkeletoncomponent usesposition: absolute, so it must be placed inside a container element withposition: relativeandoverflow: hidden. The container should also define the desired width and height for the skeleton.
Mode 1
<template>
<div style="position: relative; overflow: hidden; width: 300px; height: 20px;">
<NbSkeleton nb-id="skeleton-1" />
</div>
</template>
Preview & Playground
Select the component you want to edit/test
Loading Sandbox...
Props
Items with an (*) mean they are required
| name | Value type | Default | Description |
|---|---|---|---|
| nbId (*) | String | Sets the id attribute to differentiate from other components | |
| show | Boolean | true | Defines if the loader is visible |
| ariaLabel | String | 'Alternate Text Button' | Defines the aria-label attribute for screen readers |
| ariaAttrs | Object | {} | Allows passing custom aria attributes as an object. Keys will automatically receive the aria- prefix |
| backgroundColor | String | '#e2e8f0' | Defines the background color. Accepts Color name and Hex |
| gradientDirection | String | '90deg' | Defines the gradient direction (angle) |
| gradienteColor | String | 'rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0)' | Defines the gradient colors. Accepts a comma-separated list of colors |
| gradientAnimationDuration | String | '1.2s' | Defines the animation duration for the gradient effect |
Events
| name | Return type | Description |
|---|---|---|
| clicked | nothing | Fired when the loader is clicked, returns nothing |
| changed | value | Fired when the show prop changes, returns the new value |
Table of Contents
