hp-avatar
Hex-shaped user avatar. Image clips into the hex; falls back to the slotted content
(typically initials) on load error or while pending. Pure display element — wrap in
<hp-button> or <hp-link> for interactive avatars.
Install
bun add @hexpunk/core lit import "@hexpunk/core"; Properties
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
src | src | string | "" | Image URL. When set, the image renders inside the hex. On load error or while pending, the slotted fallback shows instead. |
alt | alt | string | "" | Alt text for the image. Required for non-decorative avatars. |
size | size | "sm" | "md" | "lg" | "md" | Avatar size — matches hp-hex sizes. |
Slots
| Slot | Description |
|---|---|
(default) | Fallback content shown when no src or on image load error |
CSS Parts
| Part | Description |
|---|---|
avatar | The avatar wrapper |
fallback | The fallback container holding the slotted initials |
Accessibility
Set alt on every avatar that conveys identity. For purely decorative
avatars (filler in a wireframe demo), pass alt="" to skip the
announcement.
No per-component entries in CHANGELOG.md yet.