Skip to main content
Neural UIv2.0.0Documentation
View v1 GitHub

Avatar

Represent a person with an image, initials and optional presence.

Category
Layout and content
Import
@neural-ui/core/avatar
Selector
neu-avatar
import { NeuAvatarComponent } from '@neural-ui/core/avatar';

Usage

Use src for an image and name for initials. If the image fails, the component falls back to initials; changing src to another URL retries the image. alt takes precedence over name for the accessible name. size and shape set the geometry; color applies to the initials fallback. status adds a decorative presence dot, not a textual status.

Examples

Try the example and open Code to see its full implementation. Reset restores the initial demonstration state.

Examples

Ana Martรญn

Image with initials fallback

Luis Garcรญa ยท OnlineMarta Ruiz ยท Busy

Try and configure

Change the options and inspect the live preview. The generated template stays next to the controls; Code contains the complete executable source.

Try and configure

Live preview

Ana Martรญn

No presence indicator

Generated template: reflects the configuration above. Open Code for the complete imports and state.

template.html
<neu-avatar
  name="Ana Martรญn"
  size="md"
  shape="circle"
  color="blue"
/>

Data and content

The application supplies the Inputs and owns any surrounding interaction. This component has no model bindings or Outputs. Content projection and icon templates are documented separately where supported.

Accessibility and keyboard

Supply name or alt when the avatar communicates identity. Without either, the avatar is hidden from assistive technology. Presence dots are decorative: communicate availability in adjacent text, as the examples do. For a decorative image beside a complete visible name, avoid announcing the same identity repeatedly in your layout.

Key
Action
โ€” No component-level keyboard interaction; projected buttons and links keep their own keyboard behavior.

API

All public Inputs are extracted from the pinned Core package. Named types link to their definitions. Only the actual public projection areas and templates are listed below.

Inputs

Configure the component with [property]="value". Your application supplies these values; the component does not replace the state you pass in.

Name
Type
Default
Template binding
Description
altstring''[alt]Accessible name override, taking precedence over name.
colorNeuAvatarColor'blue'[color]One of the six preset initials colors; does not recolor an image.
namestring''[name]Full name used for initials and the default accessible name.
shapeNeuAvatarShape'circle'[shape]circle or square clipping.
sizeNeuAvatarSize'md'[size]xs=24, sm=32, md=40, lg=48 or xl=64 px.
srcstring''[src]Image URL; a failed image falls back to name initials.
statusNeuAvatarStatus''[status]Decorative presence indicator; supply meaningful status text separately.

Templates

ng-content projects content into the component. TemplateRef inputs receive a template; ng-template directives identify templates with a typed context. A directive shared by an entrypoint is not necessarily a slot of this component.

This component does not expose content projection or public customization templates.

Public Types

Open a type to inspect its definition and interface fields.

Styles and tokens

Sizes range from 24 to 64 px. circle clips the image to a circle; square uses the public radius token. The six initials colors are component palette choices, not configurable arbitrary CSS color values. Presence follows semantic status tokens.

Specific tokens

This component uses shared theme tokens rather than dedicated component hooks.

Shared tokens used

Override these on a local wrapper to affect this example. An override on :root affects other components that use the same token.

Token
Purpose here
Other impact
Default / fallback
--neu-error Invalid field or danger-action color Shared by other Core consumers; scope the override. #dc2626
--neu-radius Control corner radius Shared by other Core consumers; scope the override. 8px
--neu-surface Main field, header or control surface Shared by other Core consumers; scope the override. #ffffff
--neu-surface-2 Secondary surfaces and alternating rows Shared by other Core consumers; scope the override. #f1f5f9
--neu-text-disabled Text of disabled controls Shared by other Core consumers; scope the override. #64748b
--neu-text-muted Secondary labels and supporting content Shared by other Core consumers; scope the override. #475569
--neu-font-sans Text typography Shared by other Core consumers; scope the override. 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif
--neu-success Inherited theme value used by this component Shared by other Core consumers; scope the override. #15803d