Skeleton not displaying.
<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">
<p-skeleton shape="circle" size="4rem" styleClass="p-mr-2"></p-skeleton>
<div>
<p-skeleton width="10rem" styleClass="p-mb-2"></p-skeleton>
<p-skeleton width="5rem" styleClass="p-mb-2"></p-skeleton>
<p-skeleton height=".5rem"></p-skeleton>
</div>
</div>
<p-skeleton width="100%" height="150px"></p-skeleton>
<div class="p-d-flex p-jc-between p-mt-3">
<p-skeleton width="4rem" height="2rem"></p-skeleton>
<p-skeleton width="4rem" height="2rem"></p-skeleton>
</div>
</div>
</div>
</div>
I have copied the above code in my html as it from your primgfaces.org site. the skeleton is not displayed. Niether I get any errors.
- add skeleton in your code
- add skeletonModule =>
import { SkeletonModule } from 'primeng/skeleton'; - add css (with encapsulation: ViewEncapsulation.None or global css into angular.json) =>
/* SKELETON */
.p-component,
.p-component *,
.p-skeleton,
.skeleton * {
box-sizing: border-box;
}
.p-skeleton {
background-color: #e9ecef;
border-radius: 3px;
}
.p-skeleton:after {
background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0));
}
/* SKELETON */
.p-component, .p-component *, .p-skeleton, .skeleton * { box-sizing: border-box; }
.p-skeleton { background-color: #e9ecef; border-radius: 3px; } .p-skeleton:after { background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0)); }
I tried this and it is working, but I want to know why this it's required and can't find any mention of it in PrimeNG docs.
Seems to fixed in v12 and v13.
As of 2024, it doesn't work again. I've had to copy paste the CSS from above. I'm using PrimeReact.
As of 2024, it doesn't work again. I've had to copy paste the CSS from above. I'm using PrimeReact.
Hi ! Have you manage to fix it? I having the same issue
As of 2024, it doesn't work again. I've had to copy paste the CSS from above. I'm using PrimeReact.
Hi ! Have you manage to fix it? I having the same issue
I did what @gregorypiva suggested above and that fixed it!