Avatar
Shows a person or a record as a small round image; without a photo, initials are made from the name.
zb:avatar zubazar/ui · free (MIT)
Size and color
size picks the size (xs or sm in dense lists, lg or xl in profile headers) and color the background of the initials.
<zb:avatar name="Ayşe Yılmaz" size="md" color="primary" />
<zb:avatar name="Ayşe Yılmaz" size="md" color="success" />
<zb:avatar name="Ayşe Yılmaz" size="md" color="warning" />
<zb:avatar name="Ayşe Yılmaz" size="md" color="danger" />
<zb:avatar name="Ayşe Yılmaz" size="xs" color="primary" />
<zb:avatar name="Ayşe Yılmaz" size="xs" color="success" />
<zb:avatar name="Ayşe Yılmaz" size="xs" color="warning" />
<zb:avatar name="Ayşe Yılmaz" size="xs" color="danger" />
<zb:avatar name="Ayşe Yılmaz" size="sm" color="primary" />
<zb:avatar name="Ayşe Yılmaz" size="sm" color="success" />
<zb:avatar name="Ayşe Yılmaz" size="sm" color="warning" />
<zb:avatar name="Ayşe Yılmaz" size="sm" color="danger" />
<zb:avatar name="Ayşe Yılmaz" size="lg" color="primary" />
<zb:avatar name="Ayşe Yılmaz" size="lg" color="success" />
<zb:avatar name="Ayşe Yılmaz" size="lg" color="warning" />
<zb:avatar name="Ayşe Yılmaz" size="lg" color="danger" />
<zb:avatar name="Ayşe Yılmaz" size="xl" color="primary" />
<zb:avatar name="Ayşe Yılmaz" size="xl" color="success" />
<zb:avatar name="Ayşe Yılmaz" size="xl" color="warning" />
<zb:avatar name="Ayşe Yılmaz" size="xl" color="danger" />
| Prop | Values |
|---|---|
size | xs | sm | md | lg | xl |
color | primary | secondary | success | danger | warning | info | dark |
Initials and colors
Without a photo, the initials of the first two words of name are shown ("Ayşe Yılmaz" → AY); color picks the background color.
<div class="flex flex-wrap items-center gap-4">
<zb:avatar name="Ayşe Yılmaz" />
<zb:avatar name="Mehmet Kaya" color="success" />
<zb:avatar name="Zeynep Arslan" color="warning" />
<zb:avatar name="Emre Demir" color="danger" />
<zb:avatar name="Fatma Şahin" color="info" />
<zb:avatar name="Can Öztürk" color="secondary" />
</div>
| Prop | Values |
|---|---|
name | Full name; the initials are generated from it |
color | primary | secondary | success | danger | warning | info | dark (brand = primary, neutral = secondary) |
Photo
src shows the photo; still give name, as it becomes the alternative text and nothing is left blank if the photo fails to load.
<zb:avatar src="{{ $user->avatar_url }}" :name="$user->name" size="lg" />
| Prop | Values |
|---|---|
src | Photo address |
Status
status adds a status dot at the bottom right: online, offline, away or busy.
<div class="flex flex-wrap items-center gap-4">
<zb:avatar name="Ayşe Yılmaz" status="online" />
<zb:avatar name="Mehmet Kaya" color="success" status="offline" />
<zb:avatar name="Zeynep Arslan" color="warning" status="away" />
<zb:avatar name="Emre Demir" color="danger" status="busy" />
</div>
| Prop | Values |
|---|---|
status | online | offline | away | busy |
Groups
zb:avatar-group overlaps the avatars; add the number of people not shown as "+N" with more.
<zb:avatar-group :more="4">
<zb:avatar name="Ayşe Yılmaz" />
<zb:avatar name="Mehmet Kaya" color="success" />
<zb:avatar name="Zeynep Arslan" color="warning" />
<zb:avatar name="Emre Demir" color="info" />
</zb:avatar-group>
| Prop | Values |
|---|---|
more | Number of people not shown ("+N"); hidden when 0 |
Props
The values the component takes. What are props and slots?
| Prop | Type | Default | Description |
|---|---|---|---|
src, name | — | null | Without a photo, initials from the name |
size | — | md | xs · sm · md · lg · xl |
shape | — | circle | circle · rounded-sm |
status | — | null | online · offline · away · busy |
color | — | primary | primary · secondary · success · danger · warning · info · dark (brand = primary, neutral = secondary) |
avatar-group: more | number | 0 | "+N" indicator |
avatar-group: size | — | md | Size of the "+N" indicator; give the same as the avatars (xs · sm · md · lg · xl) |
Advanced
Shapes
The default shape is a circle. For records that are not people, such as organizations, teams or products, use a square with rounded corners via shape="rounded-sm".
<div class="flex flex-wrap items-center gap-4">
<zb:avatar name="Ayşe Yılmaz" size="lg" />
<zb:avatar name="Zubazar Soft" size="lg" shape="rounded-sm" />
</div>
| Prop | Values |
|---|---|
shape | circle | rounded-sm |