v0.3.1 StableFoundation ComponentReact 18 & 19Zero Runtime CSS

Avatar

A person’s image with a readable initials fallback.

Interactive preview

Usage

import { Avatar } from "@devvy-ui/react";

<Avatar name="Ada Rivera" />

API reference

Native HTML attributes, className, style and a forwarded ref are supported. Component-specific props:

PropTypeDefaultDescription
namestringrequiredAccessible person name and initials source.
src / imagePropsstring / native img props—Optional image and native image callbacks.
size / shapesm | md | lg / circle | squaremd / circleDimensions and shape.

Accessibility & behavior

Platform Behavior & Guidelines

The outer span is the named image. Its image/initials are decorative inside it. A failed source falls back without hiding the name; a changed source can load again. Use meaningful names and native className/style customization.

Source ownership

Run npx @devvy-ui/cli init once in your React project, then add the source:

npx @devvy-ui/cli add avatar

Make the source yours.

Start from the canonical implementation used by the package and registry. Change the code, keep the MIT notice, and build the behavior your project needs.

Avatar.tsxREACT / TSX

Edit your own copy. Downloaded source uses your changes; the component preview above uses the shipped version. Run the source installer first to include shared helpers.