Avatar

A person: photo or grey initials.

$ npx shadcn@latest add https://mahrdesign.faizintifada.com/r/avatar.json

Sizes

24 inline · 32 compact rows · 40 list rows · 44 top bar only · 56 person cards · 96 profile card. Nothing else exists.

DPDPDPDPDPDP

Photo and fallback

The fallback is always grey (bg-neutral-soft, text-neutral-text): colour means status or module, never a person.

SSA

AvatarStack

Max 5, then "+N". 4 px gap, no overlap: overlapping faces are hard to recognise. The stack is not interactive: no hover effect.

+4

When to use

  • Show who a row, card or request is about: Atasan, approval rows, team lists.
  • The signed-in user in the top bar (size 44).
  • A small group of people: "Bawahan langsung · 9 orang" (AvatarStack).

When not to use

  • A department or module → an icon tile, not an avatar.
  • A company → the company pill in the top bar.
  • A whole team with names and roles → PersonCard grid.

Do and don't

DoPass the full namename is the alt text and the source of the initials ("Dimas Pratama" → DP).
Don'tA colour per personRandom pastel fallbacks look like status colours. Keep every fallback grey.

Installation

Add Avatar with the shadcn CLI (your project needs a components.json and the MaHR theme: https://mahrdesign.faizintifada.com/r/theme.json), or copy the files by hand.

terminal
bunx --bun shadcn@latest add https://mahrdesign.faizintifada.com/r/avatar.json

API

import { Avatar, AvatarStack } from "@/components/ui/avatar"
PropTypeDefaultDescription
namestring–Required. Alt text + initials.
srcstring–Photo URL. Falls back to initials while loading or on error.
size24 | 32 | 40 | 44 | 56 | 9640Closed set.
decorativebooleanfalseThe name is written next to it (rows, cards, menus): hidden from screen readers, so the name is not read twice. Off when the avatar is the only label (AvatarStack).
AvatarStack people{ name: string; src?: string }[]–Shows the first max, then +N.
AvatarStack max · sizenumber · AvatarSize5 · 32