LWC Skeleton is an enterprise-grade Lightning Web Component that provides beautiful skeleton loaders for Salesforce applications. It uses authentic Salesforce Lightning Design System (SLDS) design and offers 9 different animation types to create professional loading experiences that improve perceived performance and user satisfaction.
Traditional spinners are generic and provide no context about what's loading. Skeleton loaders show the actual structure of content while it's loading, reducing user anxiety and creating a more seamless experience. This component is fully compliant with Salesforce Lightning Design System guidelines and is production-ready for any Salesforce org.
For a complete interactive demo showcasing all skeleton types and animations, visit our demo page.
- π― Authentic SLDS Design - Uses exact Salesforce Lightning skeleton design patterns
- π¨ 9 Animation Types - Shimmer, Pulse, Wave, Fade, Gradient Shift, Glow, Slide, Bounce, and None
- π± Fully Responsive - Automatically adapts to all screen sizes and devices
- β‘ Lightweight - Minimal overhead with tiny bundle size under 1kb
- π§ Highly Customizable - Easy to configure with simple attributes
- βΏ Accessibility First - Built with ARIA attributes and semantic HTML
- π Cross-Browser Compatible - Works across all modern browsers
- π Performance Optimized - Zero dependencies and optimized rendering
| Feature | LWC Skeleton | Traditional Spinner |
|---|---|---|
| Shows actual content structure | β | β |
| Preserves layout and prevents shifts | β | β |
| Improves perceived performance | β | β |
| Reduces user anxiety | β | β |
| Professional, modern appearance | β | β |
| Better UX patterns | β | β |
| Enterprise-grade experience | β | β |
-
Clone the repository:
git clone https://github.com/DEV-NKP/lwc-skeleton.git
-
Copy the
lwcSkeletonfolder into your Salesforce project:force-app/main/default/lwc/ -
Deploy to your Salesforce org:
sfdx force:source:deploy -p force-app
lwc-skeleton/
βββ lwcSkeleton/ # Main Component
β βββ lwcSkeleton.html # Component template
β βββ lwcSkeleton.js # Component JavaScript
β βββ lwcSkeleton.css # Component styles
β βββ lwcSkeleton.js-meta.xml # Component metadata
βββ lwcSkeletonDemo/ # Demo Component
βββ lwcSkeletonDemo.html # Demo template
βββ lwcSkeletonDemo.js # Demo JavaScript
βββ lwcSkeletonDemo.css # Demo styles
βββ lwcSkeletonDemo.js-meta.xml # Demo metadata
The main component is the core skeleton loader that can be used in any Lightning page or component. It provides all the skeleton types and animations mentioned in the API Reference section.
The demo component showcases various combinations of skeleton types and animations. It's designed to:
- Demonstrate all skeleton types with different animations
- Show how to combine multiple skeleton loaders
- Provide code examples for each use case
- Act as a reference implementation
You can place the demo component on any Salesforce page to see the exact demo of each combination of the skeleton loader. The demo component uses the main component internally and applies different configurations to showcase all possibilities.
<template if:true={isLoading}>
<c-lwc-skeleton type="text" lines="4"></c-lwc-skeleton>
</template><template if:true={isLoading}>
<!-- Text Skeleton with Shimmer Animation -->
<c-lwc-skeleton type="text" lines="4" animation="shimmer"></c-lwc-skeleton>
<!-- Small Text Skeleton with Wave Animation -->
<c-lwc-skeleton type="small-text" lines="2" animation="wave"></c-lwc-skeleton>
<!-- Avatar Skeleton with Pulse Animation -->
<c-lwc-skeleton type="avatar" animation="pulse"></c-lwc-skeleton>
<!-- Card Skeleton with Fade Animation -->
<c-lwc-skeleton type="card" animation="fade"></c-lwc-skeleton>
<!-- Table Skeleton with Gradient Shift Animation -->
<c-lwc-skeleton type="table" rows="6" columns="4" animation="gradient-shift"></c-lwc-skeleton>
<!-- Rectangle Skeleton with Glow Animation -->
<c-lwc-skeleton type="rectangle" width="100%" height="200px" animation="glow"></c-lwc-skeleton>
<!-- Button Skeleton with Slide Animation -->
<c-lwc-skeleton type="button" animation="slide"></c-lwc-skeleton>
<!-- Input Skeleton with Bounce Animation -->
<c-lwc-skeleton type="input" animation="bounce"></c-lwc-skeleton>
</template>import { LightningElement, track } from 'lwc';
export default class MyComponent extends LightningElement {
@track isLoading = true;
connectedCallback() {
// Simulate data loading
setTimeout(() => {
this.isLoading = false;
}, 2000);
}
}| Property | Type | Default | Description |
|---|---|---|---|
type |
String | 'text' |
Skeleton type: text, small-text, avatar, card, table, rectangle, input, button |
animation |
String | 'shimmer' |
Animation type: shimmer, pulse, wave, fade, gradient-shift, glow, slide, bounce, none |
lines |
Number | 3 |
Number of text lines (for text type) |
rows |
Number | 5 |
Number of table rows (for table type) |
columns |
Number | 3 |
Number of table columns (for table type) |
width |
String | '100%' |
Width for rectangle type |
height |
String | '150px' |
Height for rectangle type |
radius |
String | '4px' |
Border radius for rectangle type |
isloading |
Boolean | true |
Controls whether skeleton is visible |
- Shimmer - Classic shimmer effect with moving highlight
- Pulse - Fading in and out effect
- Wave - Wave-like animation moving across the skeleton
- Fade - Simple fade in and out animation
- Gradient Shift - Shifting gradient effect
- Glow - Pulsing glow/brightness effect
- Slide - Sliding highlight effect
- Bounce - Subtle scale animation
- None - No animation (static skeleton)
<template if:true={isLoading}>
<c-lwc-skeleton type="text" lines="4" animation="shimmer"></c-lwc-skeleton>
</template><template if:true={isLoading}>
<c-lwc-skeleton type="table" rows="5" columns="3" animation="wave"></c-lwc-skeleton>
</template><template if:true={isLoading}>
<c-lwc-skeleton type="card" animation="pulse"></c-lwc-skeleton>
</template><template if:true={isLoading}>
<c-lwc-skeleton
type="rectangle"
width="100%"
height="200px"
radius="8px"
animation="gradient-shift">
</c-lwc-skeleton>
</template>| Browser | Version |
|---|---|
| Chrome | 90+ |
| Firefox | 88+ |
| Safari | 14+ |
| Edge | 90+ |
We welcome contributions to the LWC Skeleton component! Please follow the instructions below to get started.
- Clone the repository
- Install dependencies
- Start the development server
- Make your changes
- Add tests for new features
- Submit a pull request
Niloy Kanti Paul
- Senior Software Engineer.
- Salesforce Developer & Architect
- Full-Stack Development Specialist
- AI & Machine Learning Enthusiast
Connect with me:
LWC, Lightning Web Component, Salesforce, Skeleton Loader, Loading State, SLDS, Lightning Design System, UI Component, User Experience, Performance, Animation, Shimmer, Pulse, Wave, Frontend, Salesforce Development, Lightning Component, Salesforce Lightning, Web Component, JavaScript, CSS, HTML, Responsive Design, Accessibility, ARIA, Enterprise Software, CRM, Customer Experience, Loading Animation, Skeleton Screen, Placeholder UI, Progressive Loading, Perceived Performance
This project is licensed under the MIT License - see the LICENSE file for details.
- Salesforce Lightning Design System for design guidelines
- The Salesforce community for inspiration and feedback
- All contributors who have helped improve this component
β If you find this component useful, please give it a star on GitHub!