npx shadcn@latest add https://components.bksh.site/r/avatar.json

UI

Avatar

Deterministic avatars from any seed — DiceBear CC0 art styles or an abstract shader gradient.

Example.tsx
import { Avatar } from "@/components/better/avatar"
// npm i @dicebear/core @dicebear/collection
// Same seed always renders the same avatar.
export function Example() {
return (
<Avatar
seed="bikash"
style="gradient"
size={96}
round={true}
speed={0}
/>
)
}

Dependencies

Props

<Avatar />

PropTypeDefaultDescription
seed*stringSame seed → same avatar, always. Use a user id, email, or handle.
styleAvatarStyle"gradient"
sizenumber64Side of the square avatar box, in px.
roundbooleantrueRounded-full by default; set false for a squircle.
speednumber0Gradient style only: 0 leaves the shader frozen on its first frame.
classNamestring

<AvatarPicker />

PropTypeDefaultDescription
defaultSeedstringSeed to start on; a random one is drawn if omitted.
defaultStyleAvatarStyle"gradient"
stylesreadonly AvatarStyle[]AVATAR_STYLESStyles offered in the row of swatches.
sizenumber96
onChange(value: { seed: string; style: AvatarStyle }) => voidFires whenever the user lands on a different avatar.
classNamestring