Xzero UI
Pro library

Avatar

A compact identity marker for people and accounts.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/avatar
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui/avatar

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { Avatar } from "@/components/xzero/avatar/avatar";

export function Owner() {
  return <Avatar name="Maya Chen" src="/people/maya.jpg" size="lg" status="online" />;
}

API reference

Avatar

A round portrait that falls back to initials and can show an online or offline dot.

PropTypeDefaultDescription
name (required)string–Full name. Used for the accessible label and the first two initials.
srcstring–Image URL. Renders a plain img, or the image component set with XzeroProvider (such as next/image). Falls back to initials if it fails to load.
size"sm" | "md" | "lg" | "xl""md"Diameter, from 28px to 88px.
status"online" | "offline"–Adds a presence dot and appends the status to the label.
...propsHTMLAttributes<HTMLSpanElement>–Forwarded to the root span, including className.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in avatars

Guidance for AI tools

Avatar: A compact identity marker for people and accounts. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components