Skeleton
Simulate the layout of content while loading
Use the Skeleton
component to indicate the loading state of your application. They can be used to improve perceived loading speed, and can provide a seamless transition between loading and fully-loaded content, helping users to stay oriented. They can also help you reduce layout shifts while content is dynamically loaded within your page.
You can call the Skeleton
component without any props. This will create a component that will take up the full width and height of its container.
Setting Dimensions
To change the dimensions of your Skeleton
component, you can specify a width
and height
prop:
Skeleton Types
The Skeleton
component also comes with 3 different types; rounded
, rectangular
, and circle
:
Note that you must set the width
and height
props to the same values when using the circle
type, otherwise, your circle will be distorted.
Animations
The default animation of the Skeleton
component is a wave animation. This can be configured with the animate
prop. It can be changed to pulse
or false
for no animation:
Custom Colors
You can customize the colors of your Skeleton
component using the color
and waveColor
props:
The waveColor
is only used if the animate
type is set to wave
(default). These props allows you to customize the colors of each Skeleton
component. However, if you need to specify a custom color globally for all of your Skeleton
components, the preferred way is to override the following CSS variables instead:
API
Prop | Default | Purpose |
---|---|---|
animate | wave | Sets the animation of the skeleton. Set to false to disable animation. |
type | rounded | Sets the type of the skeleton. |
width | 100% | Sets the width of the skeleton. |
height | 100% | Sets the height of the skeleton. |
color | var(--w-color-primary-60) | Sets the background color of the skeleton. |
waveColor | var(--w-color-primary-50) | Sets the wave color of the skeleton when animation is set to wave . |
className | - | Pass additional CSS classes for the component. |
Request improvement for this page