Skip to content
Drivn logoDrivn

Avatar

Displays a user avatar with image support and fallback initials.

Preview

SM
MD
LG
XL

Installation

npx drivn add avatar

Usage

1import { Avatar } from "@/components/ui/avatar"
2
3export default function Page() {
4 return (
5 <Avatar
6 src="/avatar.jpg"
7 alt="John Doe"
8 fallback="JD"
9 />
10 )
11}

API Reference

PropTypeDefaultDescription
srcstringURL of the avatar image
altstringAlt text for the avatar image
fallbackstringText displayed when no image is provided (first 2 characters, uppercased)
size"sm" | "md" | "lg" | "xl""md"Size of the avatar
classNamestringAdditional CSS classes to apply