user-avatar-rv
v1.0.6
Published
π§βπ¨ user-avatar-rv
Downloads
10
Maintainers
Readme
π§βπ¨ user-avatar-rv
A lightweight, customizable Angular Web Component for displaying user avatars with initials fallback. Easily embed it in any Angular, React, Vue, or plain HTML app.
β¨ Features
π‘ Shows initials when no image is available.
π Supports multiple sizes: small, medium, large.
π² Circular or square shape.
β‘ Built as a standalone Angular Element (Web Component).
π Easy to plug into any frontend framework.π¦ Installation
npm i user-avatar-rv
π οΈ Usage in Angular
Add the script to angular.json:
"scripts": [
"node_modules/user-avatar-rv/main.js"
]
Or you can include it via CDN if you publish it to jsDelivr or similar.Use the custom element in your template:
`<user-avatar
[firstName]="'Jane'"
[lastName]="'Doe'"
[imageUrl]=""
[size]="'large'"
[shape]="'circle'"
[style]="{color: 'red'}"
(onAvatarClick)="($event)=>{console.log($event)}"
>
</user-avatar>`π§© Inputs
| Input | Type | Default | Description |
|-------------|-----------------------------|-----------|--------------------------------------|
| firstName | string | '' | First name of the user |
| lastName | string | '' | Last name of the user |
| imageUrl | string | '' | Optional avatar image URL |
| size | 'small' 'medium' 'large' | 'medium' | Size of the avatar |
| shape | 'circle' 'square' | 'circle'| Shape of the avatar (circle/square) |
| style | json | {}| Custom styles for the avatar
