Playground
Change the props and copy the code. The controls come from the component's TypeScript types.
Props
import { Avatar } from "@/components/ui/avatar";<Avatar name="Michael" />Installation
$ pnpm dlx shadcn@latest add @synccn/avatarFirst time in this project? Connect synccn with one command.
Usage
import { Avatar, AvatarGroup } from "@/components/ui/avatar";<Avatar name="Michael" status="online" />API reference
Generated from the component's TypeScript types, so it always matches the code.
Avatar
Image with an initials fallback and an optional presence dot.
- src
stringImage URL. Falls back to initials if missing or broken.
- name
stringPerson's name, used for initials, colour and alt text.
- size
"xs" | "sm" | "md" | "lg"Default
"md"Diameter preset.
- status
"online" | "away" | "busy" | "offline"Shows a presence dot.
- className
stringExtra classes for the root element.
AvatarGroup
- peoplerequired
{ name: string; src?: string; status?: "online" | "away" | "busy" | "offline" }[]People to show.
- max
numberDefault
4Avatars shown before a “+N” bubble.
- size
"xs" | "sm" | "md" | "lg"Default
"sm"Diameter preset for every avatar.
- className
stringExtra classes for the root element.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
Helpers
- lib/utilscn (merges class names)
npm packages
- clsx for cn()
- tailwind-merge for cn()
Accessibility
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA attributes: aria-label