shadcn.io is not affiliated with official shadcn/ui
Avatar examples · Standard
Avatar with Count Indicator (Standard) for React
A round avatar with a red count of unread messages at its top corner.
The red bubble with a number is the quickest way to say something is waiting. This React avatar wraps a round avatar with a small destructive Badge showing 3 at its top corner, with visually hidden words that say what the number counts. Use it for unread messages, pending requests or notifications next to a person.
Preview
Installation
FAQ
How is the unread count built?
The count is a Badge with pill, size="sm", and variant="destructive". The visible text is 3, and the same badge hides the words "unread messages" for screen readers.
How is the count positioned?
The avatar sits in a relative w-fit wrapper. The badge's span is absolute -end-2.5 -top-2.5, with rounded-full bg-background p-0.5 so a gap shows around the pill. -end follows the writing direction.
How do I change the number?
Replace the text 3. The badge has no count prop. Keep the hidden words in step with whatever the number means.
How do I change the count color?
variant="destructive" is the red treatment. default or secondary swap the color and still take pill and size="sm".
Related
- Avatar with Online Indicator (Standard)A round avatar with a green dot at the
- Avatar with Verification Check (Standard)A round avatar with a blue verified badge
- Avatar with Count Indicator (Square)A square avatar with a red count of
- Avatar StandardA round avatar with a profile picture and
- Avatar with Offline Indicator (Standard)A round avatar with a gray dot at the
- Avatar with Placeholder Icon (Standard)A round avatar with no picture that shows