Skeleton is a placeholder to display instead of the actual content.
+
+
+import Skeleton from 'primevue/skeleton';
+
+
+
+ Skeleton displays a rectangle in its simplest form.
+
+
+<Skeleton />
+
+
+
+ The other option is the circle by setting shape property as "circle".
+
+
+<Skeleton shape="circle"/>
+
+
+
+ In order to customize the size, use width and height properties for rectangles and size for Circle and Square shapes.
+
+
+<Skeleton width="100%" height="2rem" />
+<Skeleton shape="circle" size="50px" />
+
+
+
+ The default border radius of a rectangle is specified by the theme and can be overriden using the borderRadius property.
+
+
+<Skeleton borderRadius="16px" />
+
+
+
+ Animation can be turned of by setting animation to "none".
+
+
+<Skeleton animation="none" />
+
+
+
+ Any property as style and class are passed to the main container element. Following are the additional properties to configure the component.
+Name | +Type | +Default | +Description | +
---|---|---|---|
shape | +string | +rectangle | +Shape of the element, options are "rectangle" and "circle". | +
size | +string | +null | +Size of the Circle or Square. | +
width | +string | +100% | +Width of the element. | +
height | +string | +1rem | +Height of the element. | +
borderRadius | +string | +null | +Border radius of the element, defaults to value from theme. | +
animation | +string | +wave | +Type of the animation, valid options are "wave" and "none". | +
Following is the list of structural style classes, for theming classes visit
Name | +Element | +
---|---|
p-skeleton | +Container element. | +
p-skeleton-circle | +Container element of a determinate progressbar. | +
p-skeleton-animation-none | +Container element of an indeterminate progressbar. | +
None.
+
+
+<div class="card">
+ <div class="p-grid p-formgrid">
+ <div class="p-field p-col-12 p-md-6">
+ <h5>Rectangle</h5>
+ <Skeleton class="p-mb-2"></Skeleton>
+ <Skeleton width="10rem" class="p-mb-2"></Skeleton>
+ <Skeleton width="5rem" class="p-mb-2"></Skeleton>
+ <Skeleton height="2rem" class="p-mb-2"></Skeleton>
+ <Skeleton width="10rem" height="4rem"></Skeleton>
+ </div>
+ <div class="p-field p-col-12 p-md-6">
+ <h5>Rounded</h5>
+ <Skeleton class="p-mb-2" borderRadius="16px"></Skeleton>
+ <Skeleton width="10rem" class="p-mb-2" borderRadius="16px"></Skeleton>
+ <Skeleton width="5rem" borderRadius="16px" class="p-mb-2"></Skeleton>
+ <Skeleton height="2rem" class="p-mb-2" borderRadius="16px"></Skeleton>
+ <Skeleton width="10rem" height="4rem" borderRadius="16px"></Skeleton>
+ </div>
+ <div class="p-field p-col-12 p-md-6">
+ <h5 class="p-mt-3">Square</h5>
+ <div class="p-d-flex p-ai-end">
+ <Skeleton size="2rem" class="p-mr-2"></Skeleton>
+ <Skeleton size="3rem" class="p-mr-2"></Skeleton>
+ <Skeleton size="4rem" class="p-mr-2"></Skeleton>
+ <Skeleton size="5rem"></Skeleton>
+ </div>
+ </div>
+ <div class="p-field p-col-12 p-md-6">
+ <h5 class="p-mt-3">Circle</h5>
+ <div class="p-d-flex p-ai-end">
+ <Skeleton shape="circle" size="2rem" class="p-mr-2"></Skeleton>
+ <Skeleton shape="circle" size="3rem" class="p-mr-2"></Skeleton>
+ <Skeleton shape="circle" size="4rem" class="p-mr-2"></Skeleton>
+ <Skeleton shape="circle" size="5rem"></Skeleton>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="card">
+ <div class="p-grid p-formgrid">
+ <div class="p-field p-col-12 p-md-6 p-pr-md-6 p-pr-0">
+ <h5>Card</h5>
+ <div class="custom-skeleton p-p-4">
+ <div class="p-d-flex p-mb-3">
+ <Skeleton shape="circle" size="4rem" class="p-mr-2"></Skeleton>
+ <div>
+ <Skeleton width="10rem" class="p-mb-2"></Skeleton>
+ <Skeleton width="5rem" class="p-mb-2"></Skeleton>
+ <Skeleton height=".5rem"></Skeleton>
+ </div>
+ </div>
+ <Skeleton width="100%" height="150px"></Skeleton>
+ <div class="p-d-flex p-jc-between p-mt-3">
+ <Skeleton width="4rem" height="2rem"></Skeleton>
+ <Skeleton width="4rem" height="2rem"></Skeleton>
+ </div>
+ </div>
+ </div>
+
+ <div class="p-field p-col-12 p-md-6">
+ <h5>List</h5>
+ <div class="custom-skeleton p-p-4">
+ <ul class="p-m-0 p-p-0">
+ <li class="p-mb-3">
+ <div class="p-d-flex">
+ <Skeleton shape="circle" size="4rem" class="p-mr-2"></Skeleton>
+ <div style="flex: 1">
+ <Skeleton width="100%" class="p-mb-2"></Skeleton>
+ <Skeleton width="75%"></Skeleton>
+ </div>
+ </div>
+ </li>
+ <li class="p-mb-3">
+ <div class="p-d-flex">
+ <Skeleton shape="circle" size="4rem" class="p-mr-2"></Skeleton>
+ <div style="flex: 1">
+ <Skeleton width="100%" class="p-mb-2"></Skeleton>
+ <Skeleton width="75%"></Skeleton>
+ </div>
+ </div>
+ </li>
+ <li class="p-mb-3">
+ <div class="p-d-flex">
+ <Skeleton shape="circle" size="4rem" class="p-mr-2"></Skeleton>
+ <div style="flex: 1">
+ <Skeleton width="100%" class="p-mb-2"></Skeleton>
+ <Skeleton width="75%"></Skeleton>
+ </div>
+ </div>
+ </li>
+ <li>
+ <div class="p-d-flex">
+ <Skeleton shape="circle" size="4rem" class="p-mr-2"></Skeleton>
+ <div style="flex: 1">
+ <Skeleton width="100%" class="p-mb-2"></Skeleton>
+ <Skeleton width="75%"></Skeleton>
+ </div>
+ </div>
+ </li>
+ </ul>
+ </div>
+ </div>
+ </div>
+
+ <h5>DataTable</h5>
+ <DataTable :value="products">
+ <Column field="code" header="Code">
+ <template #body>
+ <Skeleton></Skeleton>
+ </template>
+ </Column>
+ <Column field="name" header="Name">
+ <template #body>
+ <Skeleton></Skeleton>
+ </template>
+ </Column>
+ <Column field="category" header="Category">
+ <template #body>
+ <Skeleton></Skeleton>
+ </template>
+ </Column>
+ <Column field="quantity" header="Quantity">
+ <template #body>
+ <Skeleton></Skeleton>
+ </template>
+ </Column>
+ </DataTable>
+</div>
+
+
+
+