Avatar Select
Select a person with a generated avatar in both the trigger and option list.
View codeHide code
"use client";
import { AvatarSelect } from "@/components/blobz/avatar-select";
const PEOPLE = [
{
avatar: { name: "Raj", palette: ["#dff4ff", "#38bdf8"] },
description: "Product designer",
id: "raj",
name: "Raj Reddy",
},
{
avatar: {
name: "Janaki",
palette: ["#e7fbe8", "#9ce786"],
},
description: "Engineering lead",
id: "janaki",
name: "Janaki Ammal",
},
{
avatar: {
name: "Vikram",
palette: ["#fff0e2", "#fa9769"],
},
description: "Platform engineer",
id: "vikram",
name: "Vikram Sarabhai",
},
] as const;
export function AvatarSelectExample() {
return (
<AvatarSelect className="max-w-sm" defaultValue="raj" items={PEOPLE} />
);
}Installation
npx shadcn@latest add @blobz/avatar-selectThe official shadcn Select and Blobz Avatar components are installed automatically.
Usage
"use client";
import { AvatarSelect } from "@/components/blobz/avatar-select";
<AvatarSelect
defaultValue="paul"
items={people}
onValueChange={setSelectedPerson}
/>Each item requires a stable id, visible name, and Blobz avatar props. The optional description is shown as supporting text.
API
AvatarSelect
Prop
Type
AvatarSelectOption
Prop
Type
The avatar source accepts a stable name and optional src, frame, palette, and choices. Images automatically fall back to the generated face.