Shimmer effect in Angular Skeleton component
27 Apr 20244 minutes to read
You can use the shimmerEffect
property to change animation effect in the skeleton control. Skeleton supports Wave
, Pulse
and Fade
effects and by default, the shimmerEffect
is set to Wave
effect.
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `<ejs-skeleton shape= 'Circle' width= "60px" shimmerEffect= 'Pulse'></ejs-skeleton>`
})
export class AppComponent { }
Below example demonstrates a list with pulse effect skeleton.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { SkeletonModule } from '@syncfusion/ej2-angular-notifications'
import { Component } from '@angular/core';
@Component({
imports: [
SkeletonModule
],
standalone: true,
selector: 'my-app',
template: `<div>
<ul id="skeleton-list" class="e-card">
<li>
<div class='listProfile'>
<ejs-skeleton shape="Circle" width="40px" shimmerEffect='Pulse'></ejs-skeleton>
</div>
<div>
<ejs-skeleton width="60%" height='15px' shimmerEffect='Pulse'></ejs-skeleton><br>
<ejs-skeleton width="40%" height='15px' shimmerEffect='Pulse'></ejs-skeleton>
</div>
</li>
<li>
<div class='listProfile'>
<ejs-skeleton shape="Circle" width="40px" shimmerEffect='Pulse'></ejs-skeleton>
</div>
<div>
<ejs-skeleton width="60%" height='15px' shimmerEffect='Pulse'></ejs-skeleton><br>
<ejs-skeleton width="40%" height='15px' shimmerEffect='Pulse'></ejs-skeleton>
</div>
</li>
</ul>
</div>`
})
export class AppComponent {}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
/* Represents the styles for loader */
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
#skeleton-list {
padding-left: 12px;
padding-top: 7px;
line-height: inherit;
}
#skeleton-list li {
list-style: none;
display: flow-root;
margin-bottom: 9px;
}
.listProfile {
float: left;
margin-right: 15px;
}