Skeleton
23 Sep 20254 minutes to read
The Shimmer is a placeholder that animates a shimmer effect to let users know that the page’s content is loading at the moment.
In other terms, it simulates the layout of page content while loading the actual content.
<div id="skeletonCircle"></div><script>
var skeletonObj = new Skeleton({ shape: 'Circle', width: "2rem" });
skeletonObj.appendTo("#skeletonCircle");
</script>Properties
cssClass string
Defines single/multiple classes (separated by space) to be used for customization of Skeleton.
Defaults to ””
enablePersistence boolean
Enable or disable persisting component’s state between page reloads.
Defaults to false
enableRtl boolean
Enable or disable rendering component in right to left direction.
Defaults to false
height string|number
Defines the height of the Skeleton.
Height is not required when shape is “Circle” and “Square”.
Defaults to ””
label string
Defines the ‘aria-label’ for Skeleton accessibility.
Defaults to “Loading…”
locale string
Overrides the global culture and localization value for this component. Default global culture is ‘en-US’.
Defaults to ’’
shape string|SkeletonType
Defines the shape of the Skeleton.
<div id='skeleton'></div>import { Skeleton } from '@syncfusion/ej2-notifications';
let skeleton: Skeleton = new Skeleton({
shape: 'Circle',
width: '48px'
});
skeleton.appendTo('#skeleton');Defaults to SkeletonType.Text
shimmerEffect string|ShimmerEffect
Defines the animation effect of the Skeleton.
<div id='skeleton'></div>import { Skeleton } from '@syncfusion/ej2-notifications';
let skeleton: Skeleton = new Skeleton({
shape: 'Circle',
width: '48px',
shimmerEffect: 'Pulse'
});
skeleton.appendTo('#skeleton');Defaults to ShimmerEffect.Wave
visible boolean
Defines the visibility state of Skeleton.
Defaults to true
width string|number
Defines the width of the Skeleton.
Width will be prioritized and used as dimension when shape is “Circle” and “Square”.
Defaults to ””
Methods
addEventListener
Adds the handler to the given event listener.
| Parameter | Type | Description |
|---|---|---|
| eventName | string |
A String that specifies the name of the event |
| handler | Function |
Specifies the call to run when the event occurs. |
Returns void
appendTo
Appends the control within the given HTML element
| Parameter | Type | Description |
|---|---|---|
| selector (optional) |
string | HTMLElement
|
Target element where control needs to be appended |
Returns void
attachUnloadEvent
Adding unload event to persist data when enable persistence true
Returns void
dataBind
When invoked, applies the pending property changes immediately to the component.
Returns void
destroy
Method to destroys the Skeleton component.
Returns void
detachUnloadEvent
Removing unload event to persist data when enable persistence true
Returns void
getLocalData
Returns the persistence data for component
Returns any
getRootElement
Returns the route element of the component
Returns HTMLElement
handleUnload
Handling unload event to persist data when enable persistence true
Returns void
refresh
Applies all the pending property changes and render the component again.
Returns void
removeEventListener
Removes the handler from the given event listener.
| Parameter | Type | Description |
|---|---|---|
| eventName | string |
A String that specifies the name of the event to remove |
| handler | Function |
Specifies the function to remove |
Returns void
Inject
Dynamically injects the required modules to the component.
| Parameter | Type | Description |
|---|---|---|
| moduleList | Function[] |
? |
Returns void