Avatar
User avatar with image or initials fallback, sizes and circle/square shape
Same BEM classes and behavior as Astro, Svelte, and Vue.
Add this component
The command below includes <strong>Avatar</strong>—run it in your project directory to install this component (and the CSS if needed). No prompts.
Choose your package manager — click a tab to select, then copy the command.
pnpm dlx rizzo-css add Avatar
bunx rizzo-css add Avatar
Live examples
React
JD
Usage
Usage
Full example for each framework (Astro, Vanilla, Svelte, Vue, React). Switch framework via View as or by clicking a Usage tab—both stay in sync.
Astro Vanilla Svelte Vue React ---
import Avatar from '../components/astro/Avatar.astro';
---
<Avatar name="Jane Doe" />
<Avatar src="/photo.jpg" alt="Jane" />
<!-- Rizzo CSS. No script needed. -->
<div class="avatar" data-initials="JD">Jane Doe</div>
<img class="avatar avatar--img" src="/photo.jpg" alt="Jane" />
<script>
import { Avatar } from '$lib/rizzo';
</script>
<Avatar name="Jane Doe" />
<Avatar src="/photo.jpg" alt="Jane" />
<script setup>
import Avatar from '@/components/rizzo/Avatar.vue';
</script>
<template>
<Avatar name="Jane Doe" />
<Avatar src="/photo.jpg" alt="Jane" />
</template>
import { Avatar } from './components/react';
<Avatar name="Jane Doe" />
<Avatar src="/photo.jpg" alt="Jane" />
Other frameworks: Astro · Vanilla · Svelte · Vue