GhostAvatar reference
Package: @ghostvue/vue. Status: experimental (stability policy).
Headless user or entity avatar with SSR-safe image loading and initials or slot fallback. useGhostAvatar owns styling hooks and the client image probe; GhostAvatar is the thin unstyled host. Themed size hooks live on @ghostvue/themes.
Generated from the component manifest. Edit the manifest or Vue source, then rebuild the docs.
Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
alt | string | — | No | `img` accessible name; defaults to `name`. |
as | GhostAvatarElement | "span" | No | Root host. |
name | string | — | No | Initials source and default `alt`. |
src | string | — | No | Image URL. Load is confirmed after mount on the client. |
Emits
None declared.
Models
None declared.
Slots
| Name | Description |
|---|---|
fallback | Shown when the image is not displayed. |
Slot props: fallback
None declared.
Exposed members
| Name | Type | Description |
|---|---|---|
element | HTMLElement | null | The root host element after mount, or `null` before mount. |
Parts and data attributes
| Attribute | Value | Description |
|---|---|---|
data-part | root | Native span or div host when using the default as prop. |
data-part | image | img element when the src load succeeded. |
data-part | fallback | Inner host for initials or fallback slot content. |
data-state | loading | src is set and the client has not finished probing yet. |
data-state | loaded | src loaded and the img is shown. |
data-state | error | src failed to load; fallback is shown. |
CSS variables
None declared.
Accessibility
Role: generic. APG pattern: https://www.w3.org/WAI/ARIA/apg/practices/names-and-descriptions/.
Required ARIA attributes: none.
Keyboard
| Key | Action | Automated browser test |
|---|---|---|
Tab | Does not land on the avatar unless the consumer adds tabindex. | Not reviewed |
Verification
Each category is reviewed separately. Automated keyboard and axe results do not attest manual or assistive-technology review.
| Category | Status | Evidence |
|---|---|---|
| Automated keyboard | Not reviewed | No declared key is mapped to a browser test yet. |
| Manual interaction | Not reviewed | No review recorded. |
| Assistive technology | Not reviewed | No review recorded. |
Examples
avatar/basic
Fallback initials from name without an image URL.
avatar/composable
Same contract as GhostAvatar, applied to a native host.
avatar/fallback
Custom fallback when src is missing or fails to load.
avatar/image
Client image probe after SSR-safe loading fallback.
avatar/themed
Size hooks on the @ghostvue/themes wrapper.