Surfaces
Glass Avatar
A circular portrait with coloured initials as a fallback, a status dot and overlapping groups.
Preview
Installation
Install the package once, then import the parts you use into a standalone component.
Install
npm install ngx-vitreo @angular/cdk @floating-ui/domImport
import { GlassAvatar, GlassAvatarGroup } from 'ngx-vitreo';
@Component({
imports: [GlassAvatar, GlassAvatarGroup],
// ...
})Usage
Usage
<div class="cpreview-stack cpreview-stack--center">
<div class="cpreview-row cpreview-row--center">
<glass-avatar name="Ada Lovelace" size="sm" />
<glass-avatar name="Grace Hopper" status="online" />
<glass-avatar name="Alan Turing" size="lg" status="away" />
<glass-avatar name="Katherine Johnson" size="xl" status="busy" />
</div>
<glass-avatar-group aria-label="Team" [max]="4">
@for (person of people; track person) {
<glass-avatar [name]="person" />
}
</glass-avatar-group>
</div>API reference
GlassAvatar
glass-avatar
| Input | Type | Default | Description |
|---|---|---|---|
name | string | None | The person's name; supplies the initials and a stable initials colour. |
src | string | None | Image URL; the initials show until it loads, or if it fails. |
alt | string | name | Accessible name of the avatar. |
fallback / [glassAvatarFallback] | string | content | initials of name | Replaces the initials. |
size | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'md' | Diameter; ignored inside a glass-avatar-group, which sizes its avatars. |
status | 'online' | 'away' | 'busy' | 'offline' | None | A presence dot on the corner, also added to the accessible name. |
GlassAvatarGroup
glass-avatar-group
| Input | Type | Default | Description |
|---|---|---|---|
max | number | None | Shows this many avatars, then a +N avatar for the rest. |
size | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'md' | Sizes every avatar in the group, overriding each avatar's own size. |