Skip to Content
Kokonut UI

IN-02Inputs

Avatar Picker

Generated avatars from a name, morphing as you type, on a 3D coin you can flick, tap or shuffle.

Install with
lucide-react, motion

PRONatural Date Input and more like it are in Kokonut UI Pro

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 Copy code 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
stringDefault "Pick your avatar"
description
stringDefault "Made from your name. Spin it or pick one."
submitLabel
stringDefault "Continue"
className
string

Extra classes for the root element.

AvatarValue

displayNamerequired
string

The name the faces are generated from.

variantrequired
number

Which face for that name. Any integer works; each one is a new face.

Dependencies

NeedsVersionComes from
lucide-react^0.556.0npm, installed by the CLI
motion^12.23.25npm, installed by the CLI
cn from lib/utils.tsshadcn init
React19Your app
Tailwind CSS4Your app

No provider, font or global CSS to set up: the file works as soon as it lands.