Shapes in Angular Skeleton component

1 Dec 20223 minutes to read

The Skeleton control support various built-in shape variants to design layout of the page. You can use the shape property to create a preview of any layout.

The Skeleton component supports the following content shapes:

Circle skeleton shape

import { Component } from '@angular/core';

@Component({
    selector: 'my-app',
    template: `<ejs-skeleton shape= 'Circle' width= "48px"></ejs-skeleton>`
})

export class AppComponent { }

Square skeleton shape

import { Component } from '@angular/core';

@Component({
    selector: 'my-app',
    template: `<ejs-skeleton shape= 'Square' width= "48px"></ejs-skeleton>`
})

export class AppComponent { }

Rectangle skeleton shape

import { Component } from '@angular/core';

@Component({
    selector: 'my-app',
    template: `<ejs-skeleton shape= 'Rectangle' width= "50px"></ejs-skeleton>`
})

export class AppComponent { }

Text skeleton shape

import { Component } from '@angular/core';

@Component({
    selector: 'my-app',
    template: `<ejs-skeleton shape= 'Text' width= "15px"></ejs-skeleton>`
})

export class AppComponent { }

Below example demonstrates the above functionalities of a Skeleton component.

import { Component } from '@angular/core';

@Component({
    selector: 'my-app',
    template: `<div id="skeletonCard">
        <div class='cardProfile'>
            <ejs-skeleton id="cardProfile" shape="Circle" width="60px"></ejs-skeleton>
        </div>
        <div class="cardinfo">
            <ejs-skeleton id="text1" width="30%" height='15px'></ejs-skeleton><br/>
            <ejs-skeleton id="text2" width="15%" height='15px'></ejs-skeleton>
        </div>
        <div class="cardContent">
            <ejs-skeleton id="cardImage" shape="Rectangle" width="100%" height='150px'></ejs-skeleton>
        </div>
        <div class="cardoptions">
            <ejs-skeleton id="rightOption" shape="Rectangle" width="20%" height='32px'></ejs-skeleton>
            <ejs-skeleton id="leftOption" shape="Rectangle" width="20%" height='32px'></ejs-skeleton>
        </div>
    </div>`
    })

export class AppComponent {}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { SkeletonModule } from '@syncfusion/ej2-angular-notifications';

import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule, 
        SkeletonModule
    ],
    declarations: [AppComponent ],
    bootstrap: [AppComponent]
})
export class AppModule { }
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';

enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);