The Syncfusion Vue UI component library is the only suite that you will ever need to build an application because it contains over 70 high-performance, lightweight, modular, and responsive UI components in a single package.
Now, it includes a new Skeleton component as part of the 2022 Volume 3 release.
Let’s explore the features of the new Vue Skeleton component and its UI design with code examples.
The Skeleton component is a modern data loading indicator that shows a preview of the content. While the interface is loading data, the component displays a layout of how the content will appear with a shimmer effect. The user will be aware of the content layout and understand that the UI is loading, resulting in an improved user experience.
The following are a few places where the Skeleton component can be a great fit:
Note: To see a loading indicator that is similar to the Skeleton component in a data grid, refer to the Vue DataGrid Loading Animation demo.
The Vue Skeleton component has built-in support for the following features:
We can display page content in various shapes depending on the use case. Therefore, the placeholder for such content should also match the content shapes. The built-in content shapes of the Skeleton component meet this requirement. The component supports the following content shapes:
Note: For more details, refer to the Vue Skeleton component default functionalities demo with different shapes.
Different animation styles can fit the different types of pages you deliver, so we provided the following built-in shimmer (animation) effects:
Note: For more details, refer to the Vue Skeleton animation demo.
To customize the Skeleton’s size and toggle between the actual content and the placeholder, the component provides the following properties:
The Vue Skeleton component contains a minimal API for easy integration. You can easily add it to any element as a CSS component.
The Skeleton component size can be responsive or static, providing you more flexibility in creating the content layout.
Now that we have seen the features of the Vue Skeleton component, let’s see the steps to configure it in your Vue 3 applications.
First, ensure you have all the prerequisites needed to run a Vue 3 app. Then, create a Vue app using the Vue CLI.
Syncfusion Vue packages are available in the NPM registry. To install the packages required for the Skeleton component, use the following command:
npm install @syncfusion/ej2-vue-notifications --save
Now, import the required CSS styles for the Skeleton component and dependency styles in the <style> section of the src/App.vue file. Refer to the following code.
<style> @import "../node_modules/@syncfusion/ej2-base/styles/material.css"; @import "../node_modules/@syncfusion/ej2-vue-notifications/styles/material.css"; </style>
We have completed all the necessary configurations for rendering the Syncfusion Vue components. Now, let’s add the Skeleton component by following these steps:
<script> import { SkeletonComponent } from "@syncfusion/ej2-vue-notifications"; </script>
Import { SkeletonComponent } from ‘@syncfusion/ej2-vue-notifications’; export default { name: “App”, components: { ‘ejs-skeleton’: SkeletonComponent } }
<template> <div id='element'> <ejs-skeleton height='15px' width=’200px’></ejs-skeleton> </div> </template>
Summarizing the above steps, update the src/App.vue file with the following code.
<template> <div id='element'> <ejs-skeleton height='15px' width=’200px’></ejs-skeleton> </div> </template> <script> import { SkeletonComponent } from '@syncfusion/ej2-vue-notifications'; // Component Registration export default { name: "App", components: { 'ejs-skeleton': SkeletonComponent } } </script> <style> @import "../node_modules/@syncfusion/ej2-base/styles/material.css"; @import "../node_modules/@syncfusion/ej2-vue-notifications/styles/material.css"; </style>
Finally, run the application using the following command.
npm run serve
Once the web server is loaded, you can find the following output by opening the Vue app in the browser at port localhost:8080. Also, you can easily customize the shape and shimmer effect using the shape and shimmerEffect properties, respectively.
First, follow steps 1 through 3 in the previous section.
Note: You can also download and reference the Skeleton styles from our Theme Studio.
Next, follow these steps to add the Vue Skeleton as a CSS component in your application:
<div id="skeleton "></div>
<div id= "skeleton" class="e-skeleton"></div>
<div id="skeleton" class="e-skeleton e-skeleton-circle"></div>
<div id="skeleton" class="e-skeleton e-skeleton-circle e-skeleton-wave"></div>
<div id="skeleton" class="e-skeleton e-skeleton-circle e-skeleton-wave" style="height:50px; width:50px;"></div>
Refer to the following code block for the CSS classes corresponding to all Skeleton shapes and shimmer effects.
<div style="width: 200px;display:inline-block;"> <label> Circle with wave effect</Label> <div class="e-skeleton e-skeleton-circle e-shimmer-wave" style="height:50px;width:50px;"></div> <br/> <label> Square with wave effect</Label> <div class="e-skeleton e-skeleton-square e-shimmer-wave" style="height:50px;width:50px;"></div> <br/> <label> Text with wave effect</Label> <div class="e-skeleton e-skeleton-text e-shimmer-wave" style="height:15px;width:150px;"></div> </div> <div style="width: 200px;display:inline-block;"> <label> Rectangle with wave effect</Label> <div class="e-skeleton e-skeleton-rectangle e-shimmer-wave" style="height:50px;width:150px;"></div> <br/> <label> Rectangle with fade effect</Label> <div class="e-skeleton e-skeleton-rectangle e-shimmer-fade" style="height:50px;width:150px;"></div> <br/> <label> Rectangle with pulse effect</Label> <div class="e-skeleton e-skeleton-rectangle e-shimmer-pulse" style="height:50px;width:150px;"></div> <br/> </div>
Finally, run the application using the following command.
npm run serve
Once the web server is loaded, you can find the following output by opening the Vue app in the browser at port localhost:8080.
For more details, refer to the Vue Skeleton component demos and documentation.
The Skeleton component is also available in the following platforms.
Thanks for reading! In this blog, we have seen the features of the new Syncfusion Vue Skeleton component that rolled out in the 2022 Volume 3 release and the steps to getting started with it. Try out this component yourself and provide your feedback in the comments section below.
Also, check out our Release Notes and the What’s New pages to see the other features available in the 2022 Volume 3 release.
For existing customers, the new version is available for download from the License and Downloads page. If you are not yet a Syncfusion customer, you can try our 30-day free trial to check out our available features.
You can also reach us through our support forums, support portal, or feedback portal. As always, we are happy to assist you!