Menu

Avatar

User image / initials. 5 sizes × 2 types × 2 shapes.

NJ

Installation

$ npx uix-ui@latest add avatar

This copies the file into components/ui/avatar.tsx in your project. npx shadcn@latest add @uix/avatar works too.

Usage

avatar.tsx
import { Avatar } from "@/components/ui/avatar";

<Avatar initials="NJ" />

Examples

Sizes

IJIJIJIJIJ

Shape, icon, status and badge

TASRFK3

Props

PropTypeDefaultDescription
sizexs | sm | md | lg | xl"md"
shapecircle | rounded"circle"
typeinitials | icon"initials"
srcstring–Photo; initials or the icon show when it is missing.
altstring""
initialsstring–
statusbooleanfalseOnline dot on the corner.
badgeReact.ReactNode–Count pill on the corner.

Everything else is passed to the root element, so className, aria-* and event handlers work as usual.

Dependencies

Installed for you by the CLI.

  • class-variance-authority
  • clsx
  • tailwind-merge
  • lib/utils.ts
  • components/ui/icons.tsx
esc

↑↓ to navigate · ↵ to select · esc to close