Avatar
User avatar with image or initials fallback.
<arc-avatar>Overview
Avatar shows a person's profile image in a circle. When there's no src, or the image fails to load, it shows the first letter of name, uppercased, in the label font at weight 600.
The container has role="img" and uses name as its aria-label, so screen readers announce an image with the person's name. Avatar isn't interactive, but it still brightens its border and glows on hover.
Guidelines
Do
- Always set name, even with an image. The initial and the aria-label both come from it
- Use a real name, not an email address, so the initial means something
- Use sm in comment threads and table rows, and lg in profile headers and user detail panels
- Use arc-avatar-group for a row of avatars
Don't
- Don't use Avatar for logos or product icons. It is announced as a person's image
- Don't point src at a full-size photo. The component doesn't resize images, so resize them on the server
- Don't treat the hover glow as a sign it can be clicked. Avatar has no click behavior
Features
- Size presets: sm (32px), md (40px), lg (56px). The initial scales with them
- Images fill the circle with `object-fit: cover`
- On hover the border moves from `--border-default` to `--border-bright` and gets the `--interactive-hover` glow
Preview
A
B
C
Usage
<arc-avatar name="Alice Smith"></arc-avatar>
<arc-avatar name="Bob Jones" size="lg"></arc-avatar>
<arc-avatar src="https://i.pravatar.cc/150?img=1" name="User" size="sm"></arc-avatar>import { Avatar } from '@arclux/arc-ui-react';
export default function Example() {
return (
<>
<Avatar name="Alice Smith" />
<Avatar name="Bob Jones" size="lg" />
<Avatar src="https://i.pravatar.cc/150?img=1" name="User" size="sm" />
</>
);
}<script setup>
import { Avatar } from '@arclux/arc-ui-vue';
</script>
<template>
<Avatar name="Alice Smith" />
<Avatar name="Bob Jones" size="lg" />
<Avatar src="https://i.pravatar.cc/150?img=1" name="User" size="sm" />
</template><script>
import { Avatar } from '@arclux/arc-ui-svelte';
</script>
<Avatar name="Alice Smith" />
<Avatar name="Bob Jones" size="lg" />
<Avatar src="https://i.pravatar.cc/150?img=1" name="User" size="sm" />import { Component } from '@angular/core';
import { Avatar } from '@arclux/arc-ui-angular';
@Component({
imports: [Avatar],
template: `
<arc-avatar name="Alice Smith"></arc-avatar>
<arc-avatar name="Bob Jones" size="lg"></arc-avatar>
<arc-avatar src="https://i.pravatar.cc/150?img=1" name="User" size="sm"></arc-avatar>
`,
})
export class MyComponent {}import { Avatar } from '@arclux/arc-ui-solid';
export default function Example() {
return (
<>
<Avatar name="Alice Smith" />
<Avatar name="Bob Jones" size="lg" />
<Avatar src="https://i.pravatar.cc/150?img=1" name="User" size="sm" />
</>
);
}import { Avatar } from '@arclux/arc-ui-preact';
export default function Example() {
return (
<>
<Avatar name="Alice Smith" />
<Avatar name="Bob Jones" size="lg" />
<Avatar src="https://i.pravatar.cc/150?img=1" name="User" size="sm" />
</>
);
}<!-- Auto-generated by @arclux/prism — do not edit manually -->
<!-- arc-avatar — requires avatar.css + base.css (or arc-ui.css) -->
<span class="arc-avatar">
<div class="avatar" role="img" aria-label="Name">
</div>
</span><!-- Auto-generated by @arclux/prism — do not edit manually -->
<!-- arc-avatar — self-contained, no external CSS needed -->
<style>
.arc-avatar .avatar:hover { border-color: rgb(51, 51, 64);
box-shadow: 0 0 12px rgba(77, 126, 247, 0.15); }
</style>
<span class="arc-avatar" style="display: inline-flex">
<div class="avatar" style="display: inline-flex; align-items: center; justify-content: center; border-radius: 9999px; border: 1px solid rgb(34, 34, 41); overflow: hidden; background: rgb(17, 17, 22)" role="img" aria-label="Name">
</div>
</span>API
srcstring''- Image URL for the avatar. When provided, renders an
<img>element. When empty, displays initials derived from thenameprop. namestring''- User name used to generate initials (first letter, uppercased) and as the
alttext /aria-labelfor the avatar. size'sm' | 'md' | 'lg''md'- Controls avatar dimensions:
sm(32px),md(40px),lg(56px). status'' | 'online' | 'offline' | 'busy' | 'away'''- Shows a status indicator dot. Empty (the default) shows none. An unrecognised value falls back to empty rather than rendering an uncoloured dot that screen readers announce by its bogus name.
shape'circle' | 'square' | 'rounded''circle'- Controls the avatar shape. Options: 'circle', 'square', 'rounded'.