ComponentsData display

Avatar

Pictures for people, agents, and workspaces. Shows initials when there is no image or the image fails. Built with Base UI.

AM

Image status: idle

Usage

Avatar usageTSX
import {
  Avatar, AvatarImage, AvatarFallback, AvatarBadge,
} from "@tulipfarm/sprout/avatar";

<Avatar size="lg">
  <AvatarImage src={user.image} alt={user.name} />
  <AvatarFallback>AM</AvatarFallback>
  <AvatarBadge role="img" aria-label="Verified">
    <CheckIcon aria-hidden="true" />
  </AvatarBadge>
</Avatar>

Avatar takes size: "xs", "sm", "default", or "lg". The fallback shows while the image loads, when it fails, and when there is no image. Usedelay on AvatarFallback to avoid a flash on fast networks. The image fades in over 180ms; reduced motion turns this off.

Sizes, images, fallbacks, and badges
AMAMxs
AMAMsm
AMAMdefault
AMAMlg
Avatar groups
ARS
+4
sm
ARS
+4
default
ARS
+4
lg
AR
icon count

AvatarBadge sits on the bottom edge. Its icon hides at small sizes.AvatarGroup overlaps avatars, and AvatarGroupCount matches their size. Set --sprout-avatar-ring to the surface color behind a group or badge.

Agent avatars

Agent avatarTSX
<AgentAvatar agentId={agent.id} name={agent.name} size="sm" />

AgentAvatar picks stable artwork from agentId. The image is decorative; put the agent name in nearby text. Pass src to use your own artwork. agentAvatarSrc(id, baseUrl) returns the default URL.

Agent avatars
Gxs
Gsm
Gdefault
Glg
Oother id
Wfallback
Artwork is chosen from the agent id. The last example has no artwork, so it shows the first letter.
Agent list
  • CCollections assistantFollows up on overdue invoicesActive
  • OOnboarding guideWelcomes new customers and books kickoffsActive
  • IInventory watcherFlags products below reorder levelDraft
Agents table
Draft agent header
NYour new agentPersonal agentDraft
Agent showcase
CCollections assistantFollows up on overdue invoices
Workflow steps
  1. Collections assistantDrafts reminder emails
  2. ReviewA person approves

Entity avatars

Entity avatarTSX
<EntityAvatar
  seed={workspace.id}
  name={workspace.name}
  image={workspace.icon}
  size="xs"
  shape="square"
/>

EntityAvatar takes a seed, name, optional image, size up to "xl", and shape ("circle" or "square"). Without an image it shows the first letter on a gradient. The same seed always gives the same gradient. An empty name shows ?.

Entity shapes and sizes
Mcircle · xs
Mcircle · sm
Mcircle · default
Mcircle · lg
Mcircle · xl
Msquare · xs
Msquare · sm
Msquare · default
Msquare · lg
Msquare · xl
Gimage
Gsquare image
Rbroken image
?empty name
People use circles. Workspaces use squares. Without an image, the seed picks a stable gradient.
Image picker

Member photo

R

Workspace icon

S
Read-only settings row
Workspace iconG
Member table
  • AAlex Meadow
  • RRobin Field
  • SSam Orchard
  • MMember (not loaded)
Invite canvas labels
  • AAlex Meadow
  • RRobin Field
  • robin@example.com
Workspace and account menus

In conversations

Message author
AM

Alex Meadow · 10:30

Can you help plan the garden?

Mention options
AAlex MeadowFictional team member
RRobin FieldFictional team member

Image upload, file checks, menus, tables, and messages above are sample code. The package only draws the avatar. Your application owns data, uploads, and navigation.

Accessibility

Give AvatarImage real alt text when the avatar is the only name on screen. Use alt="" when a name is next to it. Avatars are not focusable; put them inside a link or button for actions. Give badges and icon counts an accessible label.