Search results

Types and Styles

This section explains different types of avatar.

Avatar size

The Essential JS 2 Avatar has the following predefined sizes that can be used with the .e-avatar class to change the appearance of the avatar.

Class Name Description
e-avatar-xlarge Displays xlarge size avatar.
e-avatar-large Displays apply large size avatar.
e-avatar Displays apply default size avatar.
e-avatar-small Displays apply small size avatar.
e-avatar-xsmall Displays apply xsmall size avatar.
Source
Preview
app.component.ts
app.module.ts
main.ts
import { Component } from '@angular/core';

@Component({
    selector: 'my-app',
    template: `
    <div id='element'>
            <span class="e-avatar e-avatar-xlarge"></span>
            <span class="e-avatar e-avatar-large"></span>
            <span class="e-avatar"></span>
            <span class="e-avatar e-avatar-small"></span>
            <span class="e-avatar e-avatar-xsmall"></span>
    </div>
    `
})

export class AppComponent { }
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
    ],
    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);

Avatar types

The types of Essential JS 2 avatar are:

  • Default
  • Circle

Default

The default style of the avatar is rectangular shape with rounded corners, which can be applied from adding the modifier class .e-avatar to the target element.

Source
Preview
app.component.ts
app.module.ts
main.ts
import { Component } from '@angular/core';

@Component({
    selector: 'my-app',
    template: `
    <div id='element'>
            <span class="e-avatar e-avatar-xlarge">RT</span>
            <span class="e-avatar e-avatar-large">RT</span>
            <span class="e-avatar">RT</span>
            <span class="e-avatar e-avatar-small">RT</span>
            <span class="e-avatar e-avatar-xsmall">RT</span>
    </div>
    `
})

export class AppComponent { }
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
    ],
    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);

Circle

The circle avatar style can be applied by adding the modifier class .e-avatar-circle to the target element.

Source
Preview
app.component.ts
app.module.ts
main.ts
import { Component } from '@angular/core';

@Component({
    selector: 'my-app',
    template: `
    <div id='element'>
            <span class="e-avatar e-avatar-xlarge e-avatar-circle">SJ</span>
            <span class="e-avatar e-avatar-large e-avatar-circle">SJ</span>
            <span class="e-avatar e-avatar-circle">SJ</span>
            <span class="e-avatar e-avatar-small e-avatar-circle">SJ</span>
            <span class="e-avatar e-avatar-xsmall e-avatar-circle">SJ</span>
    </div>
    `
})

export class AppComponent { }
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
    ],
    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);