Avatar Picker - React Component | Kokonut UI
Avatar Picker
Generated avatars from a name, morphing as you type, on a 3D coin you can flick, tap or shuffle.
Installation
Avatar Picker is a free, open-source React component in the Kokonut UI Inputs collection. Add it with the shadcn CLI, which copies the source into components/kokonutui/avatar-picker.tsx, so the code is yours to change.
npx shadcn@latest add @kokonutui/avatar-picker
Or add it by hand: install its packages, then copy the source from above into components/kokonutui/avatar-picker.tsx.
npm install lucide-react motion
Usage
import AvatarPicker from "@/components/kokonutui/avatar-picker";
export default function Example() {
return <AvatarPicker />;
}
Props
value
AvatarValue
Controlled value.
defaultValue
Partial<AvatarValue>
Initial value when uncontrolled.
onChange
(value: AvatarValue & { seed: string; description: string }) => void
Called when the name changes or a face lands.
onComplete
(value: AvatarValue & { seed: string }) => void
Called by the submit button.
name
string
Form field name; a hidden input carries the avatar seed.
title
string Default "Pick your avatar"
description
string Default "Made from your name. Spin it or pick one."
submitLabel
string Default "Continue"
className
string
Extra classes for the root element.
AvatarValue
displayName required
string
The name the faces are generated from.
variant required
number
Which face for that name. Any integer works; each one is a new face.
Dependencies
| Needs | Version | Comes from |
|---|---|---|
lucide-react |
^0.556.0 |
npm, installed by the CLI |
motion |
^12.23.25 |
npm, installed by the CLI |
cn from lib/utils.ts |
shadcn init | |
| React | 19 |
Your app |
| Tailwind CSS | 4 |
Your app |
No provider, font or global CSS to set up: the file works as soon as it lands.