VSkeletonLoader
TheVSkeletonLoader component is a versatile tool for providing a visual indicator that content is loading. It can be used as a placeholder while waiting for data or as a boilerplate for content structure.
Usage
The skeleton loader can display various pre-defined bone structures.Loading State
Use theloading prop to switch between the skeleton and actual content.
When
loading is true, the skeleton is displayed. When false, the slot content is shown.Types
The skeleton loader supports many pre-defined types that represent common UI patterns.Available Types
actions- Two buttonsarticle- Heading and paragraphavatar- Avatar circlebutton- Button shapecard- Image and headingcard-avatar- Image and list item with avatarchip- Chip shapedate-picker- Full date picker structureheading- Heading textimage- Rectangle image placeholderlist-item- Single line list itemlist-item-avatar- List item with avatarlist-item-two-line- Two line list itemlist-item-avatar-two-line- Two line list item with avatarlist-item-three-line- Three line list itemlist-item-avatar-three-line- Three line list item with avatarparagraph- Three text linessentences- Two text linestable- Full table structuretext- Single text line
Multiple Types
Combine multiple types using a comma-separated string or array.Repeating Types
Use the@ syntax to repeat a type multiple times.
Custom Combinations
Create complex layouts by combining types and repetitions.Color
Customize the skeleton color with thecolor prop.
Dimensions
Control the size usingwidth, maxWidth, height, and maxHeight props.
Boilerplate
Theboilerplate prop removes the loading animation, making it suitable for wireframes and mockups.
When using the
boilerplate prop, ARIA attributes for loading states are not applied, as it’s meant for static placeholders rather than dynamic loading.Elevation
Add elevation to create depth.Card Example
A practical example showing a card with loading state.List Example
Skeleton loader for a list of items.Props
The type or types of skeleton bones to display. Can be a single type, comma-separated types, or an array. Supports
@ syntax for repetition (e.g., text@3).Controls whether to show the skeleton (true) or the slot content (false).
Removes the loading animation. Useful for static wireframes and mockups.
Applies specified color to the skeleton.
The text used for the
aria-label when loading.Sets the width of the skeleton loader.
Sets the maximum width of the skeleton loader.
Sets the height of the skeleton loader.
Sets the maximum height of the skeleton loader.
Designates an elevation applied to the component between 0 and 24.
Slots
default
The actual content to display when
loading is false.Accessibility
When loading (and not in boilerplate mode), the component includes:role="alert"aria-live="polite"aria-label(based on theloadingTextprop)
Type Reference
Here’s a comprehensive list of all available skeleton types and their structures:| Type | Structure |
|---|---|
actions | button@2 |
article | heading, paragraph |
avatar | avatar |
button | button |
card | image, heading |
card-avatar | image, list-item-avatar |
chip | chip |
date-picker | list-item, heading, divider, date-picker-options, date-picker-days, actions |
heading | heading |
image | image |
list-item | text |
list-item-avatar | avatar, text |
list-item-two-line | sentences |
list-item-avatar-two-line | avatar, sentences |
list-item-three-line | paragraph |
list-item-avatar-three-line | avatar, paragraph |
paragraph | text@3 |
sentences | text@2 |
table | table-heading, table-thead, table-tbody, table-tfoot |
text | text |