# Avatar

A picture or initials that stand for a person, a team or a source.

A picture or initials for a person, a team or a source. Inside a line of text (a chip, a mention): 12, 14 or 16px. In a list row or a table cell: 20px. Beside controls: 24, 28 or 32px (the control scale's xs, sm, md, so the avatar lines up with the buttons next to it). 40px for a profile header. Round or square. The initials sit under the image, so a slow image shows initials first and a broken image falls back to them.

Kind: component · Category: Display · Status: beta · Targets: React, Vue, Svelte

## Add

```bash
npx fndn add avatar
```

It writes the folder `avatar/` into the project's ui folder (`index.ts`, `avatar.tsx`, `Avatar.vue`, `Avatar.svelte`, `avatar.recipe.ts`). First time: [Installation](/installation.md).

## Usage

```tsx
import { Avatar } from "@/components/ui/avatar";
```

```vue
import { Avatar } from "@/components/ui/avatar";
```

```svelte
import { Avatar } from "$lib/components/ui/avatar";
```

## Parts

In the DOM the root carries `data-slot="avatar"` and each part `data-slot="avatar-<part>"`; in the recipe the root is the `base` slot and each part a slot named after it in camelCase.

| Part | Element | data-slot | Flags | Notes |
| --- | --- | --- | --- | --- |
| `root` | `span` | `avatar` |  | role="img" with aria-label when it has a name; aria-hidden otherwise. |
| `initials` | `span` | `avatar-initials` |  | One or two letters (one at 12 and 14px) on the avatar colour; aria-hidden. |
| `image` | `img` | `avatar-image` | optional | Covers the initials; alt="" (the root carries the name). Removed when it fails to load. |

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `name` | `string` |  | Accessible name; the initials come from it when initials is not given. |
| `initials` | `string` |  | Letters to show instead of the ones taken from name. |
| `src` | `string` |  | Image URL. Without it, or when it fails, the initials show. |
| `size` | `"12" \| "14" \| "16" \| "20" \| "24" \| "28" \| "32" \| "40"` | `"16"` | Edge in px. 12 · 14 · 16 inside a line of text; 20 in a list row or a table cell; 24 · 28 · 32 on the control scale (beside buttons of that height, a row of two lines); 40 for a profile or issue header. Two initials take about two thirds of the edge whatever the size (7, 8.5, 10, 12, 13, 15px at 16–40), so wide letters stay clear of the rim; 12 and 14 show one letter. |
| `shape` | `"round" \| "square"` | `"round"` | square: corners a quarter of the edge (3px at 12, 4px at 14 and 16, 5px at 20, 6 · 7 · 8 · 10px at 24 · 28 · 32 · 40). |
| `color` | `string` |  | Fill behind the initials (any colour or token); default ink-3. |

Other attributes and `class` go to the root; `class` is merged through the recipe.

## States

`broken image`

## Keyboard and accessibility

Notes:

- With a name, the root is role="img" and named; without one it is decorative (aria-hidden). Next to the same name in text, leave name out.
- The image has alt="" because the root already carries the name.

## Motion

- none: the image covers the initials when it arrives, without a fade

## Tokens

`color.ink-3`, `color.on-accent`, `color.line`

## Examples

### Workspace members

React · `workspace-members.tsx`

```tsx
import { Avatar } from "@/components/ui/avatar";

const members = [
  { name: "Maya Chen", email: "maya@northwind.example", role: "Owner", photo: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' fill='%23c9a27e'/%3E%3Ccircle cx='20' cy='16' r='8' fill='%23f6e7d8'/%3E%3Cpath d='M6 40a14 12 0 0 1 28 0z' fill='%23f6e7d8'/%3E%3C/svg%3E" },
  { name: "Daniel Okafor", email: "daniel@northwind.example", role: "Admin", color: "var(--fndn-tag-blue)" },
  { name: "Priya Raman", email: "priya@northwind.example", role: "Member", color: "var(--fndn-tag-purple)" },
];

/* a photo when there is one; initials on a colour otherwise */
export default function WorkspaceMembers() {
  return (
    <ul className="flex w-80 flex-col gap-3 text-sm">
      {members.map((member) => (
        <li key={member.email} className="flex items-center gap-2.5">
          <Avatar name={member.name} src={member.photo} color={member.color} size="20" />
          <span className="shrink-0 font-medium text-ink">{member.name}</span>
          <span className="min-w-0 truncate text-ink-2" dir="ltr" title={member.email}>{member.email}</span>
          <span className="ms-auto shrink-0 text-ink-2">{member.role}</span>
        </li>
      ))}
    </ul>
  );
}
```

Vue · `workspace-members.vue`

```vue
<script setup lang="ts">
import { Avatar } from "@/components/ui/avatar";

const members = [
  { name: "Maya Chen", email: "maya@northwind.example", role: "Owner", photo: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' fill='%23c9a27e'/%3E%3Ccircle cx='20' cy='16' r='8' fill='%23f6e7d8'/%3E%3Cpath d='M6 40a14 12 0 0 1 28 0z' fill='%23f6e7d8'/%3E%3C/svg%3E" },
  { name: "Daniel Okafor", email: "daniel@northwind.example", role: "Admin", color: "var(--fndn-tag-blue)" },
  { name: "Priya Raman", email: "priya@northwind.example", role: "Member", color: "var(--fndn-tag-purple)" },
];
</script>

<!-- a photo when there is one; initials on a colour otherwise -->
<template>
  <ul class="flex w-80 flex-col gap-3 text-sm">
    <li v-for="member in members" :key="member.email" class="flex items-center gap-2.5">
      <Avatar :name="member.name" :src="member.photo" :color="member.color" size="20" />
      <span class="shrink-0 font-medium text-ink">{{ member.name }}</span>
      <span class="min-w-0 truncate text-ink-2" dir="ltr" :title="member.email">{{ member.email }}</span>
      <span class="ms-auto shrink-0 text-ink-2">{{ member.role }}</span>
    </li>
  </ul>
</template>
```

Svelte · `workspace-members.svelte`

```svelte
<script lang="ts">
  import { Avatar } from "$lib/components/ui/avatar";

  const members = [
    { name: "Maya Chen", email: "maya@northwind.example", role: "Owner", photo: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' fill='%23c9a27e'/%3E%3Ccircle cx='20' cy='16' r='8' fill='%23f6e7d8'/%3E%3Cpath d='M6 40a14 12 0 0 1 28 0z' fill='%23f6e7d8'/%3E%3C/svg%3E" },
    { name: "Daniel Okafor", email: "daniel@northwind.example", role: "Admin", color: "var(--fndn-tag-blue)" },
    { name: "Priya Raman", email: "priya@northwind.example", role: "Member", color: "var(--fndn-tag-purple)" },
  ];
</script>

<!-- a photo when there is one; initials on a colour otherwise -->
<ul class="flex w-80 flex-col gap-3 text-sm">
  {#each members as member (member.email)}
    <li class="flex items-center gap-2.5">
      <Avatar name={member.name} src={member.photo} color={member.color} size="20" />
      <span class="shrink-0 font-medium text-ink">{member.name}</span>
      <span class="min-w-0 truncate text-ink-2" dir="ltr" title={member.email}>{member.email}</span>
      <span class="ms-auto shrink-0 text-ink-2">{member.role}</span>
    </li>
  {/each}
</ul>
```

### Assignees on an issue

React · `issue-assignees.tsx`

```tsx
import { Avatar } from "@/components/ui/avatar";

const assignees = [
  { name: "Lucas Moreau", photo: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' fill='%236f9e8c'/%3E%3Ccircle cx='20' cy='16' r='8' fill='%23f6e7d8'/%3E%3Cpath d='M6 40a14 12 0 0 1 28 0z' fill='%23f6e7d8'/%3E%3C/svg%3E" },
  { name: "Aiko Tanaka", photo: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' fill='%23c98aa0'/%3E%3Ccircle cx='20' cy='16' r='8' fill='%23f6e7d8'/%3E%3Cpath d='M6 40a14 12 0 0 1 28 0z' fill='%23f6e7d8'/%3E%3C/svg%3E" },
  { name: "Jonas Weber", photo: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' fill='%237fa6c9'/%3E%3Ccircle cx='20' cy='16' r='8' fill='%23f6e7d8'/%3E%3Cpath d='M6 40a14 12 0 0 1 28 0z' fill='%23f6e7d8'/%3E%3C/svg%3E" },
];

/* a stack: each avatar overlaps the last, a ring in the surface colour keeps them apart; photos read better than initials when they overlap */
export default function IssueAssignees() {
  return (
    <div className="flex w-80 items-center gap-3 text-sm">
      <div className="min-w-0 flex-1">
        <p className="font-medium text-ink">Usage alerts fire twice for one project</p>
        <p className="text-ink-2">#503 · data-pipeline</p>
      </div>
      <div className="flex -space-x-1">
        {assignees.map((person) => (
          <Avatar key={person.name} name={person.name} src={person.photo} size="20" className="ring-2 ring-surface" />
        ))}
      </div>
    </div>
  );
}
```

Vue · `issue-assignees.vue`

```vue
<script setup lang="ts">
import { Avatar } from "@/components/ui/avatar";

const assignees = [
  { name: "Lucas Moreau", photo: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' fill='%236f9e8c'/%3E%3Ccircle cx='20' cy='16' r='8' fill='%23f6e7d8'/%3E%3Cpath d='M6 40a14 12 0 0 1 28 0z' fill='%23f6e7d8'/%3E%3C/svg%3E" },
  { name: "Aiko Tanaka", photo: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' fill='%23c98aa0'/%3E%3Ccircle cx='20' cy='16' r='8' fill='%23f6e7d8'/%3E%3Cpath d='M6 40a14 12 0 0 1 28 0z' fill='%23f6e7d8'/%3E%3C/svg%3E" },
  { name: "Jonas Weber", photo: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' fill='%237fa6c9'/%3E%3Ccircle cx='20' cy='16' r='8' fill='%23f6e7d8'/%3E%3Cpath d='M6 40a14 12 0 0 1 28 0z' fill='%23f6e7d8'/%3E%3C/svg%3E" },
];
</script>

<!-- a stack: each avatar overlaps the last, a ring in the surface colour keeps them apart; photos read better than initials when they overlap -->
<template>
  <div class="flex w-80 items-center gap-3 text-sm">
    <div class="min-w-0 flex-1">
      <p class="font-medium text-ink">Usage alerts fire twice for one project</p>
      <p class="text-ink-2">#503 · data-pipeline</p>
    </div>
    <div class="flex -space-x-1">
      <Avatar v-for="person in assignees" :key="person.name" :name="person.name" :src="person.photo" size="20" class="ring-2 ring-surface" />
    </div>
  </div>
</template>
```

Svelte · `issue-assignees.svelte`

```svelte
<script lang="ts">
  import { Avatar } from "$lib/components/ui/avatar";

  const assignees = [
    { name: "Lucas Moreau", photo: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' fill='%236f9e8c'/%3E%3Ccircle cx='20' cy='16' r='8' fill='%23f6e7d8'/%3E%3Cpath d='M6 40a14 12 0 0 1 28 0z' fill='%23f6e7d8'/%3E%3C/svg%3E" },
    { name: "Aiko Tanaka", photo: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' fill='%23c98aa0'/%3E%3Ccircle cx='20' cy='16' r='8' fill='%23f6e7d8'/%3E%3Cpath d='M6 40a14 12 0 0 1 28 0z' fill='%23f6e7d8'/%3E%3C/svg%3E" },
    { name: "Jonas Weber", photo: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' fill='%237fa6c9'/%3E%3Ccircle cx='20' cy='16' r='8' fill='%23f6e7d8'/%3E%3Cpath d='M6 40a14 12 0 0 1 28 0z' fill='%23f6e7d8'/%3E%3C/svg%3E" },
  ];
</script>

<!-- a stack: each avatar overlaps the last, a ring in the surface colour keeps them apart; photos read better than initials when they overlap -->
<div class="flex w-80 items-center gap-3 text-sm">
  <div class="min-w-0 flex-1">
    <p class="font-medium text-ink">Usage alerts fire twice for one project</p>
    <p class="text-ink-2">#503 · data-pipeline</p>
  </div>
  <div class="flex -space-x-1">
    {#each assignees as person (person.name)}
      <Avatar name={person.name} src={person.photo} size="20" class="ring-2 ring-surface" />
    {/each}
  </div>
</div>
```

### Review requests on a pull request

React · `review-requests.tsx`

```tsx
import { Avatar } from "@/components/ui/avatar";
import { Button } from "@/components/ui/button";

const reviewers = [
  { name: "Priya Raman", initials: "PR", state: "Requested 2 h ago", color: "var(--fndn-tag-purple)" },
  { name: "Lucas Moreau", initials: "LM", state: "Requested yesterday", color: "var(--fndn-tag-cyan)" },
];

/* 28px avatars beside sm buttons: one row height, one centre line. The name is in the text
 * beside each avatar, so the avatar takes initials only and stays decorative */
export default function ReviewRequests() {
  return (
    <ul className="flex w-80 flex-col gap-2 text-sm" aria-label="Reviewers of #482 Add retry to webhook delivery">
      {reviewers.map((reviewer) => (
        <li key={reviewer.name} className="flex items-center gap-2.5">
          <Avatar initials={reviewer.initials} color={reviewer.color} size="28" />
          <span className="flex min-w-0 flex-col">
            <span className="truncate font-medium text-ink">{reviewer.name}</span>
            <span className="truncate text-xs text-ink-2">{reviewer.state}</span>
          </span>
          <Button className="ms-auto" variant="outline" size="sm">Remind</Button>
        </li>
      ))}
    </ul>
  );
}
```

Vue · `review-requests.vue`

```vue
<script setup lang="ts">
import { Avatar } from "@/components/ui/avatar";
import { Button } from "@/components/ui/button";

const reviewers = [
  { name: "Priya Raman", initials: "PR", state: "Requested 2 h ago", color: "var(--fndn-tag-purple)" },
  { name: "Lucas Moreau", initials: "LM", state: "Requested yesterday", color: "var(--fndn-tag-cyan)" },
];
</script>

<!-- 28px avatars beside sm buttons: one row height, one centre line. The name is in the text
     beside each avatar, so the avatar takes initials only and stays decorative -->
<template>
  <ul class="flex w-80 flex-col gap-2 text-sm" aria-label="Reviewers of #482 Add retry to webhook delivery">
    <li v-for="reviewer in reviewers" :key="reviewer.name" class="flex items-center gap-2.5">
      <Avatar :initials="reviewer.initials" :color="reviewer.color" size="28" />
      <span class="flex min-w-0 flex-col">
        <span class="truncate font-medium text-ink">{{ reviewer.name }}</span>
        <span class="truncate text-xs text-ink-2">{{ reviewer.state }}</span>
      </span>
      <Button class="ms-auto" variant="outline" size="sm">Remind</Button>
    </li>
  </ul>
</template>
```

Svelte · `review-requests.svelte`

```svelte
<script lang="ts">
  import { Avatar } from "$lib/components/ui/avatar";
  import { Button } from "$lib/components/ui/button";

  const reviewers = [
    { name: "Priya Raman", initials: "PR", state: "Requested 2 h ago", color: "var(--fndn-tag-purple)" },
    { name: "Lucas Moreau", initials: "LM", state: "Requested yesterday", color: "var(--fndn-tag-cyan)" },
  ];
</script>

<!-- 28px avatars beside sm buttons: one row height, one centre line. The name is in the text
     beside each avatar, so the avatar takes initials only and stays decorative -->
<ul class="flex w-80 flex-col gap-2 text-sm" aria-label="Reviewers of #482 Add retry to webhook delivery">
  {#each reviewers as reviewer (reviewer.name)}
    <li class="flex items-center gap-2.5">
      <Avatar initials={reviewer.initials} color={reviewer.color} size="28" />
      <span class="flex min-w-0 flex-col">
        <span class="truncate font-medium text-ink">{reviewer.name}</span>
        <span class="truncate text-xs text-ink-2">{reviewer.state}</span>
      </span>
      <Button class="ms-auto" variant="outline" size="sm">Remind</Button>
    </li>
  {/each}
</ul>
```

### Member profile header

React · `member-profile.tsx`

```tsx
import { Avatar } from "@/components/ui/avatar";

/* 40px in a profile header: the name beside it at the header's size */
export default function MemberProfile() {
  return (
    <div className="flex w-80 items-center gap-3">
      <Avatar initials="DO" color="var(--fndn-tag-blue)" size="40" />
      <div className="flex min-w-0 flex-col gap-0.5">
        <span className="truncate text-md font-medium text-ink">Daniel Okafor</span>
        <span className="truncate text-sm text-ink-2" dir="ltr">daniel@northwind.example · Admin</span>
      </div>
    </div>
  );
}
```

Vue · `member-profile.vue`

```vue
<script setup lang="ts">
import { Avatar } from "@/components/ui/avatar";
</script>

<!-- 40px in a profile header: the name beside it at the header's size -->
<template>
  <div class="flex w-80 items-center gap-3">
    <Avatar initials="DO" color="var(--fndn-tag-blue)" size="40" />
    <div class="flex min-w-0 flex-col gap-0.5">
      <span class="truncate text-md font-medium text-ink">Daniel Okafor</span>
      <span class="truncate text-sm text-ink-2" dir="ltr">daniel@northwind.example · Admin</span>
    </div>
  </div>
</template>
```

Svelte · `member-profile.svelte`

```svelte
<script lang="ts">
  import { Avatar } from "$lib/components/ui/avatar";
</script>

<!-- 40px in a profile header: the name beside it at the header's size -->
<div class="flex w-80 items-center gap-3">
  <Avatar initials="DO" color="var(--fndn-tag-blue)" size="40" />
  <div class="flex min-w-0 flex-col gap-0.5">
    <span class="truncate text-md font-medium text-ink">Daniel Okafor</span>
    <span class="truncate text-sm text-ink-2" dir="ltr">daniel@northwind.example · Admin</span>
  </div>
</div>
```

### Projects

React · `project-list.tsx`

```tsx
import { Avatar } from "@/components/ui/avatar";

const projects = [
  { name: "web-app", initials: "W", color: "var(--fndn-tag-orange)", env: "Production" },
  { name: "billing-api", initials: "B", color: "var(--fndn-tag-purple)", env: "Production" },
  { name: "docs-site", initials: "D", color: "var(--fndn-tag-cyan)", env: "Preview" },
];

/* square for things (projects, workspaces), round for people */
export default function ProjectList() {
  return (
    <ul className="flex w-64 flex-col gap-2.5 text-sm">
      {projects.map((project) => (
        <li key={project.name} className="flex items-center gap-2.5">
          <Avatar name={project.name} initials={project.initials} color={project.color} shape="square" size="20" />
          <span className="flex-1 font-medium text-ink">{project.name}</span>
          <span className="text-ink-2">{project.env}</span>
        </li>
      ))}
    </ul>
  );
}
```

Vue · `project-list.vue`

```vue
<script setup lang="ts">
import { Avatar } from "@/components/ui/avatar";

const projects = [
  { name: "web-app", initials: "W", color: "var(--fndn-tag-orange)", env: "Production" },
  { name: "billing-api", initials: "B", color: "var(--fndn-tag-purple)", env: "Production" },
  { name: "docs-site", initials: "D", color: "var(--fndn-tag-cyan)", env: "Preview" },
];
</script>

<!-- square for things (projects, workspaces), round for people -->
<template>
  <ul class="flex w-64 flex-col gap-2.5 text-sm">
    <li v-for="project in projects" :key="project.name" class="flex items-center gap-2.5">
      <Avatar :name="project.name" :initials="project.initials" :color="project.color" shape="square" size="20" />
      <span class="flex-1 font-medium text-ink">{{ project.name }}</span>
      <span class="text-ink-2">{{ project.env }}</span>
    </li>
  </ul>
</template>
```

Svelte · `project-list.svelte`

```svelte
<script lang="ts">
  import { Avatar } from "$lib/components/ui/avatar";

  const projects = [
    { name: "web-app", initials: "W", color: "var(--fndn-tag-orange)", env: "Production" },
    { name: "billing-api", initials: "B", color: "var(--fndn-tag-purple)", env: "Production" },
    { name: "docs-site", initials: "D", color: "var(--fndn-tag-cyan)", env: "Preview" },
  ];
</script>

<!-- square for things (projects, workspaces), round for people -->
<ul class="flex w-64 flex-col gap-2.5 text-sm">
  {#each projects as project (project.name)}
    <li class="flex items-center gap-2.5">
      <Avatar name={project.name} initials={project.initials} color={project.color} shape="square" size="20" />
      <span class="flex-1 font-medium text-ink">{project.name}</span>
      <span class="text-ink-2">{project.env}</span>
    </li>
  {/each}
</ul>
```

### Photo that fails to load

React · `missing-photo.tsx`

```tsx
import { Avatar } from "@/components/ui/avatar";

/* the photo failed to load: the initials under it show instead */
export default function MissingPhoto() {
  return (
    <div className="flex w-80 gap-2.5 text-sm">
      <Avatar name="Sofia Alvarez" src="/avatars/sofia-alvarez.png" color="var(--fndn-tag-red)" size="20" />
      <div className="min-w-0 flex-1">
        <p><span className="font-medium text-ink">Sofia Alvarez</span> <span className="text-ink-2">· 5 min ago</span></p>
        <p className="text-ink-2">Retries look good on staging. Can we ship #482 before the billing run on Dec 1?</p>
      </div>
    </div>
  );
}
```

Vue · `missing-photo.vue`

```vue
<script setup lang="ts">
import { Avatar } from "@/components/ui/avatar";
</script>

<!-- the photo failed to load: the initials under it show instead -->
<template>
  <div class="flex w-80 gap-2.5 text-sm">
    <Avatar name="Sofia Alvarez" src="/avatars/sofia-alvarez.png" color="var(--fndn-tag-red)" size="20" />
    <div class="min-w-0 flex-1">
      <p><span class="font-medium text-ink">Sofia Alvarez</span> <span class="text-ink-2">· 5 min ago</span></p>
      <p class="text-ink-2">Retries look good on staging. Can we ship #482 before the billing run on Dec 1?</p>
    </div>
  </div>
</template>
```

Svelte · `missing-photo.svelte`

```svelte
<script lang="ts">
  import { Avatar } from "$lib/components/ui/avatar";
</script>

<!-- the photo failed to load: the initials under it show instead -->
<div class="flex w-80 gap-2.5 text-sm">
  <Avatar name="Sofia Alvarez" src="/avatars/sofia-alvarez.png" color="var(--fndn-tag-red)" size="20" />
  <div class="min-w-0 flex-1">
    <p><span class="font-medium text-ink">Sofia Alvarez</span> <span class="text-ink-2">· 5 min ago</span></p>
    <p class="text-ink-2">Retries look good on staging. Can we ship #482 before the billing run on Dec 1?</p>
  </div>
</div>
```

## Recipe

`avatar.recipe.ts`:

```ts
import { tv, type VariantProps } from "../lib/tv";

/* avatar — image or initials for a person, company, source or file, round or square. Two ranges:
 * 12, 14, 16 and 20px sit inside a line of text (a chip, a cell, a mention); 24, 28, 32 and 40px
 * are the control scale's heights (xs 24 · sm 28 · md 32, and 40 for a profile header), so an
 * avatar in a list row lines up with the buttons and fields beside it. The initials are sized so
 * that two wide letters ("MC") take about two thirds of the edge at every size, clear of the rim
 * (7px in 16, 8.5 in 20, 10 in 24, 12 in 28, 13 in 32, 15 in 40); 12 and 14px show one letter,
 * about half the edge. Square corners are a quarter of the edge. The initials sit under the image
 * (one grid cell), so a slow image shows initials first
 * and a broken one (removed by the adapter; drawn as nothing even before, because alt is empty)
 * falls back. The fill comes from --fndn-avatar-color (the adapter's `color`), ink-3 by default.
 *
 * Over an image, a hairline keeps a white logo apart from a white surface: a pseudo-element on the
 * root, set by the `image` variant (the adapter knows when it renders the image part). */

export const avatar = tv({
  slots: {
    base: [
      "relative inline-grid shrink-0 size-4 overflow-hidden rounded-[50%] align-middle select-none",
      "bg-[var(--fndn-avatar-color,var(--fndn-ink-3))] text-on-accent text-[7px] font-semibold leading-none",
    ],
    initials: "grid place-items-center [grid-area:1/1] min-w-0 overflow-hidden whitespace-nowrap tracking-[-0.02em]",
    image: "[grid-area:1/1] size-full object-cover",
  },
  variants: {
    size: {
      "12": { base: "size-3 text-[6.5px]" },
      "14": { base: "size-3.5 text-[7.5px]" },
      "16": {},
      "20": { base: "size-5 text-[8.5px]" },
      "24": { base: "size-6 text-[10px]" },
      "28": { base: "size-7 text-[12px]" },
      "32": { base: "size-8 text-[13px]" },
      "40": { base: "size-10 text-[15px]" },
    },
    shape: {
      round: {},
      square: { base: "rounded-[4px]" },
    },
    image: {
      true: { base: "after:content-[''] after:absolute after:inset-0 after:rounded-[inherit] after:shadow-[inset_0_0_0_1px_var(--fndn-line)] after:pointer-events-none" },
    },
  },
  compoundVariants: [
    { shape: "square", size: "12", class: { base: "rounded-[3px]" } },
    { shape: "square", size: "20", class: { base: "rounded-[5px]" } },
    { shape: "square", size: "24", class: { base: "rounded-[6px]" } },
    { shape: "square", size: "28", class: { base: "rounded-[7px]" } },
    { shape: "square", size: "32", class: { base: "rounded-[8px]" } },
    { shape: "square", size: "40", class: { base: "rounded-[10px]" } },
  ],
  defaultVariants: { size: "16", shape: "round", image: false },
});

export type AvatarRecipeProps = VariantProps<typeof avatar>;
```
