Skeleton
Skeleton loaders are a simplified preview of some content that is loading.
Basic Usage
<Skeleton />
Playground
Variants
The Skeleton
component comes in three variants: text, rectangular and circular.
Text
This is the default variant and requires text to be nested within it. The skeleton automatically adjusts its size to take up the same amount of space as the text within it.
<Skeleton v-if="isLoading">
<span>Skeleton is the same length as this text</span>
</Skeleton>
<span v-else>Skeleton is the same length as this text</span>
<Skeleton v-if="isLoading">
<span class="tw-text-4xl">Now a bigger one</span>
</Skeleton>
<span v-else class="tw-text-4xl">Now a bigger one</span>
Rectangular
This variant allows you to set a specific width and height to display a rectangular skeleton. The width
property is optional and defaults to its container's width, but the height
property is required because its default is 0
.
<Skeleton variant="rectangular" height="150" width="150" />
Circular
Displays a Skeleton
in a circular shape. Both the width
and height
properties are required.
<Skeleton variant="circular" height="50" width="50" />
API
See the documentation below for a complete reference to all the props and classes available to the components mentioned here.