API
API
The browser module exports enhanceAvatar, createAvatar and createAvatarGroup. The React package adds Avatar and AvatarGroup.
| Name | Description |
|---|---|
enhanceAvatar(root) | Adds cutouts and fallbacks to avatar markup already on the page. Returns refresh and destroy. |
createAvatar(root, { name, src?, size?, badge? }) | Builds an avatar with initials, an image and an optional badge. Size is 40 by default. |
badge | { type: "dot" | "count" | "icon", label, corner? }. The label joins the accessible name. |
createAvatarGroup(root, options?) | Overlaps avatars and cuts each one where the next covers it. Options: overlap, 12 by default, and clearance, 2. |
getInitials(name) | Initials for a name, safe for emoji and accents. |
Avatar, AvatarGroup | The React components around the same code. |