People, agents and tools: a photo, a logo or initials, with presence, a badge and a verified mark. Group them with +N, or pair one with a name.
Used for
- Agent and teammate faces
- Workspace logos
- Run owners
- Presence in a session
- Reviewer stacks
Examples
Installation
npx knowns-ui@latest add avatarFor Claude Code, Cursor or Codex: installs it and wires the props to your own data.
Paste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install prompt
Install Avatar from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/avatar
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add avatar
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- lib/knowns/motion.tsx
- lib/knowns/motion-utils.ts
- components/ui/knowns/use-floating.ts
- components/ui/knowns/tooltip.tsx
- components/ui/knowns/tooltip-utils.ts
- components/ui/knowns/avatar.tsx
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/avatar, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "avatar" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.Props
- label
string- Name for initials and the accessible name. Status and verified are appended ("Noor Haddad, online").
- src
string- Photo. Fades in over the fallback; if it fails to load, falls back to icon, then initials, then a person glyph.
- icon
ReactNode- Logo or glyph shown instead of initials.
- size
"xs"|"sm"|"md"|"lg"|"xl"|"2xl"- Default
"md" - 20, 24, 32, 44, 56 or 72px, with matching type and corner radius.
- shape
"square"|"circle"- Default
"square" - Rounded square for agents and tools, circle for people.
- hue
string- Tint for glyphs and initials, e.g. an agent colour.
- status
"online"|"busy"|"away"|"offline"- Presence dot on the bottom-right (top-right when there is a badge).
- badge
ReactNode- Small mark on the bottom-right, e.g. a company or model logo.
- verified
boolean- Default
false - Check mark on the corner when there is no badge.
- ring
boolean- Default
false - Ring in the surface colour; AvatarGroup sets it. Dot, badge and ring use --avatar-ring (default var(--background)).
- decorative
boolean- Default
false - Hide from assistive tech when the name is already next to it.
- AvatarGroup.max
number- Show at most this many; the rest fold into "+N" with a tooltip listing them.
- AvatarGroup.size / shape
AvatarSize / shape- Default
"md" / "circle" - Applied to every avatar in the group.
- AvatarGroup.label
string- Default
"N people" - Accessible name of the group.
- AvatarGroup.onAdd
() => void- Shows a dashed + button at the end; addLabel (default "Add people") names it.
- AvatarGroup.stack
"end"|"start"- Default
"end" - Which end sits on top. "start" puts the first avatar on top, so the first person (an owner, the assignee) reads in full.
- AvatarGroup.decorative
boolean- Default
false - Pure decoration, e.g. faces beside a count: hidden from assistive tech, no group name, no hover lift, no +N and no add button.
- AvatarLabel.description
ReactNode- Supporting line under the name. AvatarLabel takes size sm | md | lg plus every Avatar prop.
| Prop | Type | Default | Description |
|---|---|---|---|
| label | string | - | Name for initials and the accessible name. Status and verified are appended ("Noor Haddad, online"). |
| src | string | - | Photo. Fades in over the fallback; if it fails to load, falls back to icon, then initials, then a person glyph. |
| icon | ReactNode | - | Logo or glyph shown instead of initials. |
| size | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "md" | 20, 24, 32, 44, 56 or 72px, with matching type and corner radius. |
| shape | "square" | "circle" | "square" | Rounded square for agents and tools, circle for people. |
| hue | string | - | Tint for glyphs and initials, e.g. an agent colour. |
| status | "online" | "busy" | "away" | "offline" | - | Presence dot on the bottom-right (top-right when there is a badge). |
| badge | ReactNode | - | Small mark on the bottom-right, e.g. a company or model logo. |
| verified | boolean | false | Check mark on the corner when there is no badge. |
| ring | boolean | false | Ring in the surface colour; AvatarGroup sets it. Dot, badge and ring use --avatar-ring (default var(--background)). |
| decorative | boolean | false | Hide from assistive tech when the name is already next to it. |
| AvatarGroup.max | number | - | Show at most this many; the rest fold into "+N" with a tooltip listing them. |
| AvatarGroup.size / shape | AvatarSize / shape | "md" / "circle" | Applied to every avatar in the group. |
| AvatarGroup.label | string | "N people" | Accessible name of the group. |
| AvatarGroup.onAdd | () => void | - | Shows a dashed + button at the end; addLabel (default "Add people") names it. |
| AvatarGroup.stack | "end" | "start" | "end" | Which end sits on top. "start" puts the first avatar on top, so the first person (an owner, the assignee) reads in full. |
| AvatarGroup.decorative | boolean | false | Pure decoration, e.g. faces beside a count: hidden from assistive tech, no group name, no hover lift, no +N and no add button. |
| AvatarLabel.description | ReactNode | - | Supporting line under the name. AvatarLabel takes size sm | md | lg plus every Avatar prop. |
What it handles
- 01Falls back from the photo in `src` to an `icon`, then to initials taken from `label` ("Noor Haddad" gives "NH"), and `initials` overrides the letters.
- 02Draws a presence dot from `status` (online, offline, busy, away) and puts it in the accessible name, as in "Noor Haddad, online".
- 03Adds a corner `badge` for a model or company mark, which moves the status dot to the top, or a `verified` check that is announced as "verified".
- 04Comes in six sizes from `xs` to `2xl` and two shapes, square or circle, with a `hue` prop to tint glyphs and initials per agent.
- 05Stacks avatars in AvatarGroup with a separating ring, folds the overflow into a "+N" chip that lists the hidden names, and never folds a single item.
- 06Offers an add button on AvatarGroup through `onAdd` and `addLabel`, and a `decorative` flag that hides the avatar when the name is already beside it.
States
- First render
- Nothing. It paints as it is
- none
- Photo loads
- The initials fade out as the photo fades in, so no letters show through
- 280ms, ease out
- Photo fails
- The photo is dropped and the icon or initials stay
- none
- Group hover
- The hovered avatar lifts by 2px above its neighbours
- 180ms, ease out
- Reduced motion
- The fade and the lift land at once
- 0ms
| State | What moves | Timing |
|---|---|---|
| First render | Nothing. It paints as it is | none |
| Photo loads | The initials fade out as the photo fades in, so no letters show through | 280ms, ease out |
| Photo fails | The photo is dropped and the icon or initials stay | none |
| Group hover | The hovered avatar lifts by 2px above its neighbours | 180ms, ease out |
| Reduced motion | The fade and the lift land at once | 0ms |
Works with
When to use
When to use
- People, agents and organisations as an image, logo or initials, with status and groups.
When not to use
- Just a state with no identity: use Status Dot.
Using with AI
Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:
- Add the Knowns UI Avatar to my app and wire it to my own data.
- I need people, agents and organisations as an image, logo or initials, with status and groups. Set that up with the Knowns UI Avatar.
- Which Avatar props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "avatar" }) and search_docs({ query: "avatar" }).