Pilipinas Interface

Foundation

  • Overview
  • Get Started
  • Colors
  • Typography
  • Icons
  • Layout & Spacing
  • States & Feedback
  • Motion & Transitions
  • Expressions

Components

  • Overview
  • Accordion
  • Alert
  • Avatar
  • Badge
  • Banner
  • Breadcrumb
  • Button
  • Card
  • Checkbox
  • Code Block
  • Combobox
  • Command Menu
  • Dialog
  • Popover
  • Progress
  • Radio Group
  • Scroll Area
  • Select
  • Skeleton
  • Switch
  • Table
  • Tabs
  • Text Field
  • Tooltip

Resources

  • Registry

Components

Avatar

An identity mark with an image, initials or an icon fallback. Group handles overlap and the +N overflow.

Preview

Individual

JCAR

Group

JDMSARPL+1

Sizes

AAAAAAA

Group sizes

ABCD+1
ABCD+1

Image with fallback

Sample userSUBI
<Avatar name="Juan dela Cruz">
  <AvatarImage src="/juan.jpg" alt="Juan dela Cruz" />
  <AvatarFallback>JC</AvatarFallback>
</Avatar>

<AvatarGroup max={4}>
  <Avatar name="Ana"><AvatarFallback>AR</AvatarFallback></Avatar>
  <Avatar name="Liza"><AvatarFallback>LT</AvatarFallback></Avatar>
</AvatarGroup>

Usage

An identity mark in a row, list or group of people.

Do and don't

  • Do. Give a meaningful avatar a name and provide initials or an icon fallback.
  • Don't. Use it for a logo or decorative art; keep those as images.

Anatomy

Avatar is the container. AvatarImage shows once it loads and hides on error. AvatarFallback or AvatarIcon sits underneath and appears when there is no image. AvatarGroup arranges several avatars with overlap and a +N chip.

Variants

  • Image. A real image, with initials underneath if it fails.
  • Initials. Two letters from a name, sized to the avatar.
  • Icon. A generic person glyph when there is no name.
  • Shape. Circle by default. Square follows a sharp shape preference, or pass shape="square".

Sizes

xs 24px, sm 28px, md 32px, default 36px, lg 40px, xl 48px and 2xl 64px. Group accepts the same size values and applies them to its children.

Props

  • Avatar: size, shape, name, decorative.
  • AvatarImage: standard image attributes; alt defaults to empty.
  • AvatarGroup: size, shape, max.

Accessibility

A meaningful avatar uses name so it is announced as an image with a label. A decorative avatar passes decorativeand is hidden. A group's +N chip has an accessible label. Never put actions inside an avatar; wrap it in a button if it must be clickable.

Related

Shape follows Expressions and the global shape preference. Sizes follow the ladder in Layout & Spacing.

← PreviousAlertNext →Badge

Install

npx shadcn@latest add @pilipinas/avatar

For your coding agent