Avatar

Avatar represents a user with an image, initials, an icon, or the agent orb.

AKTSMLJB+5
tsx
import { Avatar } from '@/components/ui/wideset/avatar/Avatar';

<Avatar.Group size="lg">
  <Avatar initials="AK" />
  <Avatar initials="TS" />
  <Avatar initials="ML" />
  <Avatar initials="JB" />
  <Avatar.More>+5</Avatar.More>
</Avatar.Group>

Installation

pnpm dlx wideset add avatar

Copies the component and any Wideset components it uses into your project.

Examples

Content

The content follows the prop you pass: src for a photo, initials for a monogram, icon for a custom glyph, agent for the orb, nothing for the default user icon. A photo whose alt is left out is decorative, so put the person's name in text next to it or in alt. If the image fails to load, the initials show instead.

tsx
import { RiRobot2Line } from '@remixicon/react';
import { Avatar } from '@/components/ui/wideset/avatar/Avatar';

export default function AvatarContent() {
  return (
    <div className="gap-ws-7 flex flex-wrap items-center justify-center">
      <Avatar
        size="xl"
        src="https://images.unsplash.com/photo-1492633423870-43d1cd2775eb?&w=128&h=128&dpr=2&q=80"
        alt="Anna Kowalska"
        initials="AK"
      />
      <Avatar size="xl" initials="TS" />
      <Avatar size="xl" icon={<RiRobot2Line />} />
      <Avatar size="xl" agent />
      <Avatar size="xl" />
    </div>
  );
}

Colors

The initials' background comes from the initials, so the same person gets the same colour on every screen. Inside Avatar.Group the colours are spread across the visible avatars, so two people with the same initials still look different. Pass color to pin one, for example for a team or a shared inbox.

tsx
import { Avatar } from '@/components/ui/wideset/avatar/Avatar';

export default function AvatarColors() {
  return (
    <div className="gap-ws-12 flex flex-col">
      <div className="gap-ws-7 flex flex-wrap items-center">
        {['AK', 'TS', 'ML', 'JB', 'PW'].map((initials) => (
          <Avatar key={initials} size="lg" initials={initials} />
        ))}
      </div>
      <Avatar.Group size="lg">
        <Avatar initials="DS" />
        <Avatar initials="DS" />
        <Avatar initials="DS" />
      </Avatar.Group>
      <div className="gap-ws-7 flex flex-wrap items-center">
        {(['brand', 'teal', 'orange'] as const).map((color) => (
          <Avatar key={color} size="lg" initials="OP" color={color} />
        ))}
      </div>
    </div>
  );
}

Shapes

Round stands for a person. Square stands for everything else that has an avatar: a team, a workspace, a company. Keeping the two apart lets users tell people from groups at a glance.

tsx
import { Avatar } from '@/components/ui/wideset/avatar/Avatar';

export default function AvatarShapes() {
  return (
    <div className="gap-ws-7 flex flex-wrap items-center">
      <Avatar size="xl" shape="round" initials="AK" />
      <Avatar size="xl" shape="square" initials="WS" />
    </div>
  );
}

Sizes

Medium is the default, for lists and comments. Extra small and small fit table cells, chips and menus; large to 2xl are for profile headers and cards where the person is the subject. Initials and the status dot scale with the avatar.

tsx
import { Avatar } from '@/components/ui/wideset/avatar/Avatar';

export default function AvatarSizes() {
  return (
    <div className="gap-ws-7 flex flex-wrap items-center">
      {(['xs', 'sm', 'md', 'lg', 'xl', '2xl'] as const).map((size) => (
        <Avatar key={size} size={size} initials="AK" />
      ))}
    </div>
  );
}

States

status is presence: online, offline or unavailable. The dot is announced to screen readers by its name, so do not repeat it in text next to the avatar. selected draws a ring for the avatar the user picked, for example the current assignee in a picker.

tsx
import { Avatar } from '@/components/ui/wideset/avatar/Avatar';

const statuses = ['online', 'offline', 'unavailable'] as const;

export default function AvatarStates() {
  return (
    <div className="gap-ws-11 flex flex-wrap items-center justify-center">
      <div className="gap-ws-7 flex items-center">
        {statuses.map((status) => (
          <Avatar key={status} size="xl" initials="AK" status={status} />
        ))}
      </div>
      <div className="gap-ws-7 flex items-center">
        <Avatar size="xl" initials="TS" selected />
        <Avatar size="xl" agent selected />
      </div>
    </div>
  );
}

Group

Avatar.Group sets size and shape for its avatars and keeps their colours distinct. It does not count or hide anything: render the avatars you want shown and put Avatar.More last with the rest as its label. With an onClick it becomes a button that opens the full list; without one it is plain text.

tsx
import { RiAddLine } from '@remixicon/react';
import { Avatar } from '@/components/ui/wideset/avatar/Avatar';

export default function AvatarGroup() {
  return (
    <div className="gap-ws-9 flex flex-col items-center">
      <Avatar.Group size="lg">
        <Avatar initials="AK" />
        <Avatar initials="TS" />
        <Avatar initials="ML" />
        <Avatar initials="JB" />
        <Avatar.More>+12</Avatar.More>
      </Avatar.Group>
      <Avatar.Group size="lg">
        <Avatar initials="AK" />
        <Avatar initials="TS" />
        <Avatar.More aria-label="Add member" onClick={() => {}}>
          <RiAddLine />
        </Avatar.More>
      </Avatar.Group>
    </div>
  );
}

API reference

NameDescriptionDefault
agent

Renders the agent orb. Figma calls this content mode `Variant=Orb`. Use instead of `src`, `initials` or `icon`.

true
—
alt

Alternative text for the image. Defaults to "" (decorative). Alternative text for the orb. Defaults to "Agent".

string
—
className

Additional CSS classes to apply to the avatar.

string
—
color

Pins the background/text pair for the initials. Left unset, the hue is derived from the initials, and `Avatar.Group` keeps its avatars distinct.

'blue''purple''pink''orange''lime''teal''brand''violet''red''yellow''green''cyan''indigo'
—
fallback

Fallback content shown when the image fails to load. Accepts a `ReactNode` (custom icon) or a `string` (initials).

ReactNode
—
icon

Custom icon to display in the avatar. Use instead of `src`, `initials` or `agent`.

ReactNode
—
initials

Initials displayed alongside the image fallback when available. The initials to display when no image is provided: one or two letters. At `xs` and `sm` only the first is drawn, as in Figma, since two crowd a 20–24px circle.

string
—
onClick

Callback fired when the avatar is clicked.

(MouseEventHandler<HTMLSpanElement> & ((event: MouseEvent<HTMLSpanElement, MouseEvent>) => void))
—
selected

Draws the selection ring. Figma's `Selected=True`.

boolean
—
shape

The shape of the avatar.

'round''square'
'round'
size

The size of the avatar.

'xs''sm''md''lg''xl''2xl'
'md'
src

The image source URL for the avatar. Use instead of `icon` or `agent`.

string
—
status

The status indicator displayed on the avatar.

'online''offline''unavailable'
—
Every other prop of <span> is passed through to it. See MDN: <span>.

Accessibility

  • A photo’s alt defaults to "" (decorative). When no name is in nearby text, set alt to it.
  • Don’t repeat the presence in text; the status dot is announced.
  • Avatar.More with onClick is a <button>; icon-only needs aria-label (“Add member”). Without onClick it is plain text.
  • agent reads “Agent” unless you pass alt.
  • The default user icon and a custom icon are decorative. To name such an avatar, put aria-label on Avatar: it is then an image with that name, or a button with onClick. A status joins the name (“Jane, online”).
  • A clickable icon avatar needs aria-label; without one it is a button with no name.
AKTSMLJB+5
tsx
import { Avatar } from '@/components/ui/wideset/avatar/Avatar';

<Avatar.Group size="lg">
  <Avatar initials="AK" />
  <Avatar initials="TS" />
  <Avatar initials="ML" />
  <Avatar initials="JB" />
  <Avatar.More>+5</Avatar.More>
</Avatar.Group>

Appearance

Color
Shape
Size

Content

Content
Shown

State

Status
Selected