Avatar

Avatars identify people, teams, or entities through initials or supplied imagery.

Overview and decision boundary

Use Avatar to identify people, teams, or entities in compact product surfaces.

Do not rely on avatar color as the only identifier.

Preview

Maya Chen
NTAlex Rivera
import { Avatar } from '@nerio-ui/ui';<Avatar name="Maya Chen" />

Installation and imports

Install the editable registry source, or use the matching package entrypoint when the product keeps Nerio as a workspace dependency.

pnpm dlx nerio add avatarimport { Avatar } from '@nerio-ui/ui';

Usage

import { Avatar } from '@nerio-ui/ui';<Avatar name="Maya Chen" />

Variants

VariantPurpose
smCompact size for dense layouts and inline use.
mdDefault size for most product surfaces.
lgLarger size for prominent local actions.
imageImage is part of the public component contract.
fallbackFallback is part of the public component contract.

Anatomy

SlotPurpose
rootCircular identity container with tokenized size.
imageOptional supplied image.
fallbackInitials generated from the provided name.

States

StatePurpose
Loaded or fallbackFallback initials preserve layout when no image is supplied.

Motion

  • State changes should use shared motion tokens and preserve reduced-motion behavior.

Accessibility

  • Use the name prop to generate fallback initials.
  • Non-decorative images and fallbacks require a non-empty supplied alt text or normalized name; decorative fallbacks are hidden.
  • Do not rely on Avatar alone for critical identification in dense lists.

API

PropPurpose
classNameExtends the component root while preserving Nerio tokenized defaults.

Implementation contract

ContractValue
Registry itemavatar installs 5 source files into the configured components directory.
Base UINo interactive primitive required.
Registry dependenciesNone.
Package dependenciesclsx, react, tailwind-merge, tailwindcss

Styling contract

ContractValue
AuthoringComplete, statically detectable Tailwind CSS v4 recipes own component visuals.
ValuesSemantic and component --n-* variables remain the canonical customization layer.
OverridesCustomizable slots merge consumer className values with tailwindCn so conflicting utilities resolve deterministically.
Residual CSSOnly shared keyframes and scoped no-Preflight compatibility rules remain; there is no parallel visual selector layer.

Design notes

  • Use Avatar to identify people, teams, or entities in compact product surfaces.

Do / do not

Do

Pair avatars with names in dense lists when possible.

Do not

Do not rely on avatar color as the only identifier.

Tokens

These are the primary customization points. Override semantic or component tokens instead of changing component source.

TokenPurpose
--n-avatar-size-smPublic customization point for this component contract.
--n-avatar-size-mdPublic customization point for this component contract.
--n-avatar-size-lgPublic customization point for this component contract.
--n-avatar-borderPublic customization point for this component contract.
--n-avatar-backgroundPublic customization point for this component contract.