Components/Data display/Avatar
COMPONENT45.45

Avatar

Circular identity: image or initials in figure[data-variant="avatar"], with stacked groups, overlap and count badges.


INSTALL

1pnpm dlx @sayagodev/mo add avatar

Or import the files from the package (no copy):

1import "@sayagodev/mo/css/avatar.css";

EXAMPLES

Basic
CN
With badge
CN
With badge icon
PP
Size
CN
CN
CN
Group
CN
LR
ER
Group count
CN
LR
ER
+3
Group count with icon
CN
LR
ER
With dropdown menu

RTL
CN
ER
CN
LR
ER
Demo
CN
ER
CN
LR
ER
+3

USAGE

1<figure data-variant="avatar"></figure>2<figure data-variant="avatar"><img src="…" alt="" /></figure>3 4<!-- stacked group with count -->5<figure data-variant="avatar" role="group">6  <figure data-variant="avatar"><img src="…" alt="" /></figure>7  <figure data-variant="avatar">+3</figure>8</figure>

API

NAMEKINDDESCRIPTION
data-variant="avatar"attributeSelects the component on figure
.small / .largeclasssize-6 / size-10 like shadcn
[data-size="sm|lg"]attributeAlternate size API — data-size mirrors shadcn prop
role="group"attributeStacked group with overlap
[data-badge]attributeAbsolute status dot/plus on the avatar corner
--mo-avatar-sizetokenExplicit size override

FILES

src/css/avatar.css
Install:mo add avatar

THEMING · PLAYGROUND

This is the exact component from the examples above, wearing a completely different theme. Edit the tokens and --mo-* hooks in the editor — autocomplete knows them all — and the preview obeys in real time. Your CSS always wins.

Tokens & hooks — edit live
Global tokens
--background--muted--muted-foreground--primary--primary-foreground--radius--success--warning
Component hooks
--mo-avatar-size

Preview

CN

Your CSS

Try it: type --mo- for the component hooks, or edit any value — the preview obeys in real time.