Skip to content
Pixelbits
Docs / Avatar
Data display

Avatar

A 5 x 5 mirrored pixel pattern derived from seed (same seed, same pattern), drawn in the text color with one accent pixel. Used as the avatar fallback; also handy as a placeholder anywhere.

KR
+1

Installation

npm: import
import { Avatar, AvatarGroup } from "pixelbits/avatar";
shadcn: copy the source
npx shadcn add https://pixelbits.ali-moradi-develop.com/r/avatar.json

API

<PixelIdenticon>

A 5 x 5 mirrored pixel pattern derived from seed (same seed, same pattern), drawn in the text color with one accent pixel. Used as the avatar fallback; also handy as a placeholder anywhere.

<Avatar>

A person's picture, square with a 2 px radius like the rest of the kit. Without a photo it shows a pixel identicon unique to the name (or the initials).

Example
<Avatar name="Ali Moradi" src="/ali.jpg" status="online" />
<Avatar name="Karen Ross" fallback="initials" />
PropTypeDefaultDescription
name*string—

The person's name: the accessible label, and the seed of the fallback.

srcstring—

Photo URL. If missing or broken, the pixel identicon is shown.

size"sm" | "md" | "lg" | "xl""md"

"sm" 24 px, "md" 36 px, "lg" 48 px, "xl" 64 px.

fallback"identicon" | "initials""identicon"

What to show without a photo: a pixel identicon of the name, or the initials.

status"online" | "away" | "busy"—

A small square in the corner, e.g. "online".

childrenReactNode—

Overrides the visible fallback content entirely.

Also accepts every prop of HTMLAttributes<HTMLSpanElement>.

<AvatarGroup>

Overlapping avatars for a team or the people on a document.

Example
<AvatarGroup max={3}>{people.map((p) => <Avatar key={p.id} name={p.name} src={p.photo} />)}</AvatarGroup>
PropTypeDefaultDescription
maxnumber4

Show at most this many avatars, then a +N square.

children*ReactNode—

Avatars.

Also accepts every prop of HTMLAttributes<HTMLDivElement>.