nla

ngx-letters-avatar

Angular package that generates avatar with the initial letters of the provided name

Showing:

Popularity

Downloads/wk

47

Maintenance

No Maintenance Data Available

Package

Dependencies

0

License

MIT

Type Definitions

Built-In

Tree-Shakeable

Yes?

Categories

Angular Avatar

Readme

Angular letters-avatar Component Ngx-letters-avatar (Angular 2+)

Component will genrate an avatar of your name's initial letters

Features

  • Set width and height properties or only one of them.
  • Set the avatarName property wich is used to display the initials.
  • Set the src property to show ordinary image in case you don't want to show letters avatar.
  • You can set the fontFamily for the characters.
  • You can set circular which is a boolean value to true or false to create a circlular shaped image.
  • You can set borderRadius property to make rounded border for the shape.
  • You can set id property for the image.

Getting Started

Installing

npm i ngx-letters-avatar

Configuration

Ensure you import the module and the dependencies:

import { BrowserModule } from "@angular/platform-browser";
import { NgModule } from "@angular/core";
import { LettersAvatarModule } from "ngx-letters-avatar";

@NgModule({
  declarations: [],
  imports: [BrowserModule, LettersAvatarModule],
  exports: [],
  providers: []
})
export class AppModule {}

Basic Usage

<div *ngFor="let user of users">
  <p>{{ user.name }}</p>
  <ngx-letters-avatar 
    [avatarName]="user.name" 
    [width]="40" 
    [circular]="true"
    fontFamily="Open Sans"></ngx-letters-avatar>
</div>
@Component({
  selector: 'app',
  templateUrl: "./app.component.html",
  styleUrls: ["./app.component.css"],
});

export class App {
  users = [
    { name: "Girgis A.Jacoub", id: 1 },
    { name: "Your name", id: 2 },
    { name: "another name", id: 3 },
  ];
}

Api for letters-avatar Component

These are the list of Inputs[] that are supported by the component. Configure the settings to meet your requirement.

InputTypeDescriptionDefault Value
widthnumberWill be used as the width of the image. if provided, you don't need to provide the height property as the height will be the same. only set height and width in case you want to set differnt width and height values.60
heightnumberWill be used as the height of the image. if provided, you don't need to provide the width property.none
avatarNamestringThe name which the initial letters are taken from.none
srcstringThe src of the image. provide it in case you want to show image instead of letters avatar.none
classNamestringTo provide a class or classes for the image tag.none
fontFamilystringTo provide a font fanily for the characters.Arial
circularbooleanto make a circular shaped img.false
borderRadiusnumberto make a rounded bordered shape image.none
idstringto provide id attribute for the image tag.none

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Tutorials

No tutorials found
Add a tutorial