# Avatar group

Profile photos, presence indicators and teammate selection.

Access: pro. Category: Essentials. Kind: primitive.

## When to use

- Use it when a product interface needs profile photos, presence indicators and teammate selection.
- Choose it when the host application can supply the required state and keep business logic outside the presentation component.

## Alternatives

- Choose tidal-button instead when press, loading, success and disabled states is the actual interface need, rather than avatar group.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Avatar group

```sh
npx shadcn@latest add @tidal-pro/avatar
```

Stylesheets: `components/ui/tidal.css`, `components/ui/avatar.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/avatar.css";
import{TidalAvatar}from"./components/ui/avatar";
export default()=><div className="tidal-scope"><TidalAvatar name={"Demo"}/></div>;
```

## Structured props

- `TidalAvatarGroup.label: string`: Required label value accepted by this exported component.
- `TidalAvatarGroup.members: Array<TidalAvatarMember>`: Required members value accepted by this exported component.
- `TidalAvatarGroup.className?: string | undefined` (default ""): Optional class name value accepted by this exported component.
- `TidalAvatarGroup.dir?: "ltr" | "rtl" | undefined` (default "ltr"): Optional dir value accepted by this exported component.
- `TidalAvatarGroup.name?: string | undefined`: Optional name value accepted by this exported component.
- `TidalAvatarGroup.onSelect?: ((id: string) => void) | undefined`: Callback invoked when the select interaction is proposed.
- `TidalAvatarGroup.required?: boolean | undefined`: Optional required value accepted by this exported component.
- `TidalAvatarGroup.selectedId?: string | undefined`: Optional selected id value accepted by this exported component.
- `TidalAvatarGroup.theme?: "light" | "dark" | undefined` (default "light"): Optional theme value accepted by this exported component.
- `TidalAvatar.name: string`: Required name value accepted by this exported component.
- `TidalAvatar.decorative?: boolean | undefined` (default false): Use inside a control that already carries the person's accessible name.
- `TidalAvatar.presence?: TidalPresence | undefined`: Optional presence value accepted by this exported component.
- `TidalAvatar.selected?: boolean | undefined` (default false): Optional selected value accepted by this exported component.
- `TidalAvatar.shape?: "circle" | "rounded" | undefined` (default "rounded"): Optional shape value accepted by this exported component.
- `TidalAvatar.size?: "sm" | "md" | "lg" | undefined` (default "md"): Optional size value accepted by this exported component.
- `TidalAvatar.src?: string | undefined`: Optional src value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/avatar.tsx) | [Manifest](https://tidalui.com/examples/avatar.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
import "./components/ui/tidal.css";

import { useState } from "react";

import { Check } from "lucide-react";

import { TidalAvatar, TidalAvatarGroup, type TidalAvatarMember } from "./components/ui/avatar";

import { TidalButton } from "./components/ui/tidal-button";

import { TidalStatusBadge } from "./components/ui/status-badge";

import "./components/ui/avatar.css";

import "./components/ui/status-badge.css";

import "./components/ui/tooltip.css";

function tidalExampleAvatarDataUri(seed: unknown) {
  const text = String(seed).replace(/[^a-z0-9]/gi, "").slice(-2) || "UI";
  const palette = ["#333333", "#555555", "#777777", "#999999", "#bbbbbb"];
  const color = palette[Array.from(text).reduce((sum, character) => sum + character.charCodeAt(0), 0) % palette.length];
  const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96"><rect width="96" height="96" rx="48" fill="${color}"/><circle cx="48" cy="38" r="17" fill="white" fill-opacity=".92"/><path d="M18 92c3-22 15-34 30-34s27 12 30 34" fill="white" fill-opacity=".92"/></svg>`;
  return `data:image/svg+xml,${encodeURIComponent(svg)}`;
}

function tidalExampleImageDataUri(label: string) {
  const safeLabel = label.replace(/[<>&]/g, "").slice(0, 28) || "Sample image";
  const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 675"><defs><linearGradient id="g" x1="0" x2="1" y1="0" y2="1"><stop stop-color="#171717"/><stop offset="1" stop-color="#555555"/></linearGradient></defs><rect width="1200" height="675" fill="url(#g)"/><circle cx="950" cy="100" r="260" fill="white" fill-opacity=".08"/><text x="80" y="570" fill="white" font-family="system-ui,sans-serif" font-size="64" font-weight="700">${safeLabel}</text></svg>`;
  return `data:image/svg+xml,${encodeURIComponent(svg)}`;
}

const tidalExampleStyles = ".avatar-specimen{width:100%;max-width:580px;padding:28px;border:1px solid var(--t-border);border-radius:var(--t-radius-card);background:var(--t-surface);box-shadow:0 24px 40px -28px #00000035,0 2px 4px #00000008}.avatar-specimen>h3{font-size:29px;font-weight:500;line-height:1.08;letter-spacing:-1px;margin:13px 0 29px}.avatar-specimen>h3>em{font-family:\"Instrument Serif\",serif;font-size:1.2em;font-weight:400}.avatar-demo-profile{display:flex;align-items:center;gap:20px;padding:22px;border:1px solid var(--t-border);border-radius:13px;background:var(--t-subtle)}.avatar-demo-profile>div{min-width:0}.avatar-demo-profile .demo-eyebrow{font-size:11px;color:var(--t-muted)}.avatar-demo-profile h4{font-size:23px;line-height:1.2;font-weight:500;letter-spacing:-.7px;margin:7px 0 4px;overflow-wrap:anywhere}.avatar-demo-profile p{font-size:11px;color:var(--t-muted);margin:0;line-height:1.8}.avatar-demo-people{display:flex;align-items:center;justify-content:space-between;gap:15px;margin:20px -8px 21px}.avatar-demo-people>span{font-size:11px;line-height:1.8;color:var(--t-muted);max-width:175px}.avatar-demo-task{border-top:1px solid var(--t-border);padding-top:22px;display:flex;align-items:center;justify-content:space-between;gap:12px}.avatar-demo-task .demo-eyebrow{font-size:11px}.avatar-demo-task h4{font-size:12px;line-height:1.6;font-weight:550;margin:7px 0 0}.avatar-demo-task>.tidal-status-badge{flex:none}.avatar-demo-actions{display:flex;align-items:center;gap:8px;margin-top:22px}.avatar-demo-actions>.tidal-button{font-size:11px}.avatar-demo-note{font-size:11px;line-height:1.8;color:var(--t-muted);margin:18px 0 0;min-height:36px}@media(prefers-reduced-motion:no-preference){.avatar-demo-profile>div{animation:tidal-avatar-detail-in 240ms var(--t-ease-out)}}@keyframes tidal-avatar-detail-in{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}@media(max-width:420px){.avatar-specimen{padding:22px}.avatar-demo-profile{padding:18px;gap:14px}.avatar-demo-profile h4{font-size:21px}.avatar-demo-people{flex-wrap:wrap;gap:8px;margin-block:16px}.avatar-demo-people>span{margin-left:8px}.avatar-demo-task{flex-wrap:wrap}}";

const members:TidalAvatarMember[]=[{id:"ava",name:"Ava Chen",src:tidalExampleAvatarDataUri("01"),presence:"available"},{id:"noah",name:"Noah Reed",src:tidalExampleAvatarDataUri("02"),presence:"away"},{id:"mila",name:"Mila Stone",src:tidalExampleAvatarDataUri("03"),presence:"busy"},{id:"eli",name:"Eli Park",src:tidalExampleAvatarDataUri("04"),presence:"offline"}];

const roles:Record<string,string>={ava:"Product design",noah:"Frontend engineering",mila:"Design systems",eli:"Customer experience"};

export function AvatarDemo({theme="light"}:{theme?:"light"|"dark"}){
  const [selected,setSelected]=useState("ava");
  const [assigned,setAssigned]=useState<string|null>(null);
  const person=members.find(member=>member.id===selected)!;
  return <div className="avatar-specimen">
    <div className="avatar-demo-profile"><TidalAvatar name={person.name} src={person.src} presence={person.presence} size="lg" selected /><div key={person.id}><span className="demo-eyebrow">SELECTED TEAMMATE</span><h4>{person.name}</h4><p>{roles[person.id]} · {person.presence ? person.presence.charAt(0).toUpperCase()+person.presence.slice(1) : ""}</p></div></div>
    <div className="avatar-demo-people"><TidalAvatarGroup label="Choose a sample teammate" members={members} selectedId={selected} onSelect={setSelected} theme={theme} /><span>Choose a teammate.</span></div>
    <div className="avatar-demo-task"><div><span className="demo-eyebrow">SAMPLE TASK</span><h4>Polish the landing page</h4></div><TidalStatusBadge label={assigned?"Sample assigned":"Ready to assign"} status={assigned?"success":"neutral"} /></div>
    <div className="avatar-demo-actions"><TidalButton onClick={()=>setAssigned(person.name)}>{assigned===person.name?<Check size={14} aria-hidden="true" />:null}Assign to {person.name.split(" ")[0]}</TidalButton><TidalButton variant="ghost" onClick={()=>setAssigned(null)}>Reset</TidalButton></div>
    <p className="avatar-demo-note" role="status">{assigned?`${assigned} is assigned to this sample task. Nothing is sent or saved.`:"Choose a teammate, then assign the sample task in this preview."}</p>
  </div>;
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <AvatarDemo />
    </div>
  );
}

```

## Gotchas

- The host application owns data, validation, persistence, navigation, and service side effects described by this API.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order.","Arrow-key behavior follows the exported composite-control implementation."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

TidalAvatar: required name, optional src, size sm|md|lg, shape circle|rounded, presence available|away|busy|offline, selected, decorative, native span attributes/ref. Photos render in grayscale, load by opacity and fall back to initials on error. Initials normalize NFC and use Intl.Segmenter graphemes when available, with a normalized code-point fallback. A failed image does not retry on unrelated renders; changing src or remounting creates a fresh attempt. Role img carries name/presence; use decorative inside named controls. TidalAvatarGroup: required label/members({id,name,src?,presence?,disabled?}[]), optional selectedId/onSelect, name/required, theme, dir, className. With onSelect, controlled horizontal Radix radio group with arrows/Home/End, looping disabled skip and native form values. Without it, static people group. Unique nonempty member IDs; choose an enabled member. Only the selected group portrait shows its presence glyph; all accessible names preserve presence words. Includes its own tooltip provider; theme applies to portal. Consumer owns assignment and persistence.
