logo

Aki UI

アキ ウイ

Avatar Picker

アバターピッカー

A strip of avatars that behaves the way a set of radios does: the group takes one Tab stop, the arrows move the selection, and Home and End jump to the ends. Only the checked thumbnail carries tabindex 0 — the roving tabindex pattern the radiogroup role expects — so a keyboard never has to walk through every face to get past the picker. The artwork is a prop: pass any node per avatar, and initials are drawn when you pass none, which keeps the component about the selection rather than about the illustrations. Adapted from Kokonut UI under the MIT licence.

NB
Nori Beck

Installation

Install the following dependencies:1

npm install framer-motionnpm install lucide-react

Copy and paste the following code into a new component file:2

"use client"

/**
* Adapted for Aki UI from Kokonut UI's Avatar Picker.
* Original author: @dorianbaffier — https://kokonutui.com
* Copyright (c) 2025 kokonutUI, MIT License.
* https://github.com/kokonut-labs/kokonutui
*
* Reworked here onto the local palette, with shadcn primitives removed,
* motion/react swapped for framer-motion, the bundled artwork replaced by an

How to use it3

"use client"

import { AvatarPicker } from "@/components/ui/avatar-picker"

export default function Page() {
return (
<AvatarPicker
avatars={[
{ id: "fox", label: "Fox", art: <FoxIllustration /> },
{ id: "owl", label: "Owl", art: <OwlIllustration /> },

Props

AvatarPicker

NameDefaultDescription
avatars5 monograms

{ id: string, label: string, art?: ReactNode }[]

The choices; art falls back to the label's initials

defaultValuefirst avatar

string

Id selected on mount

onChange

(id: string) => void

Called with the id whenever the selection moves

label"Choose an avatar"

string

Accessible name of the group

darkfalse

boolean

Render the dark palette