Avatars
Avatars are visual representations of users that can display profile pictures, initials, or fallback icons. They support various sizes, shapes, and status indicators for rich user interfaces.
Basic Usage
Avatars come in different sizes and shapes to suit various design needs. Choose between circular (default), rounded, or square shapes.
Avatar Sizes and Shapes
<div class="flex items-center gap-4">
<byte-avatar
src="https://byteui.dev/assets/andrea-fomera-8411cac6.jpg"
size="sm">
</byte-avatar>
<byte-avatar
src="https://byteui.dev/assets/andrea-fomera-8411cac6.jpg"
size="md"
shape="rounded">
</byte-avatar>
<byte-avatar
src="https://byteui.dev/assets/andrea-fomera-8411cac6.jpg"
size="lg"
shape="square">
</byte-avatar>
</div>
Fallback Display
When an image fails to load or isn't provided, avatars can display initials or a default user icon. This ensures a consistent look even when images are unavailable.
Avatar Fallbacks
<div class="flex items-center gap-4">
<byte-avatar
fallback="AF"
size="md">
</byte-avatar>
<byte-avatar
fallback="JD"
size="md"
shape="rounded">
</byte-avatar>
<byte-avatar
size="md"
shape="square">
</byte-avatar>
</div>
Status Indicators
Add status indicators to show user presence states like online, offline, busy, or away. Status indicators automatically position themselves based on the avatar's shape.
Avatars with Status
<div class="flex items-center gap-4">
<byte-avatar
src="https://byteui.dev/assets/andrea-fomera-8411cac6.jpg"
size="lg"
status="online">
</byte-avatar>
<byte-avatar
src="https://byteui.dev/assets/andrea-fomera-8411cac6.jpg"
size="lg"
status="busy">
</byte-avatar>
<byte-avatar
fallback="AF"
size="lg"
status="away">
</byte-avatar>
<byte-avatar
src="https://byteui.dev/assets/andrea-fomera-8411cac6.jpg"
size="lg"
status="offline">
</byte-avatar>
</div>
Avatar Groups
Stack multiple avatars together to represent groups or teams. Use the fallback option to show the number of additional users.
Grouped Avatars
<div class="flex -space-x-2">
<byte-avatar src="https://byteui.dev/assets/andrea-fomera-8411cac6.jpg" size="sm"></byte-avatar>
<byte-avatar src="https://byteui.dev/assets/andrea-fomera-8411cac6.jpg" size="sm"></byte-avatar>
<byte-avatar fallback="+3" size="sm"></byte-avatar>
</div>
API Reference
Properties
string
string
'md'
string
'circle'
string
string
Size Reference
Best Practices
- Use appropriate sizes for different contexts
- Provide meaningful fallback text (usually user initials)
- Keep status indicators up to date
- Use consistent shapes within the same context
- Optimize avatar images for performance
Interactive Tour Example
Adding a Tour to Your UI
<div id="tour-demo-container">
<byte-avatar
id="demo-avatar"
src="https://byteui.dev/assets/andrea-fomera-8411cac6.jpg"
size="lg"
status="online">
</byte-avatar>
<byte-tour-step
target="#demo-avatar"
title="Welcome to Byte!"
content="This is an example of a tour step. You can use this to guide users through your application.">
</byte-tour-step>
</div>