Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

Items with Avatars Combobox for Vue

A people combobox with an avatar on each row and on the button, falling back to the name's first letter.

UI library: Ark UI

Each person has a small avatar beside the name. After a pick, that avatar and name show on the button. If the image fails, the first letter of the name shows instead.

Use it for assignees, reviewers, and mentions. A name with no picture is a text Combobox row. In Vue, Ark UI does not load the image. The avatar does.

Preview

Preview width

Installation

MCP · Pro
Make your AI a shadcn expert
Your agent installs components, builds pages and restyles your app from one prompt, in Claude Code, Cursor or VS Code.
Part of Pro

Anatomy

Combobox anatomy: control, input, trigger, content, item, item indicator

Usage

<Combobox
  :collection="collection"
  @input-value-change="handleInputValueChange"
  @value-change="handleValueChange"
  :positioning="{ getAnchorElement: () => triggerRef }"
  selectionBehavior="clear"
  :value="value"
>
  <ComboboxTrigger
    :class='cn(
      buttonVariants({ variant: "outline" }),
      "w-[250px] justify-between"
    )'
    ref="triggerRef"
  >
    <span v-if="selected" class="flex items-center gap-2">
      <Avatar class="size-5"><AvatarImage alt="" :src="selected.avatar" /><AvatarFallback>{{ selected.label.charAt(0) }}</AvatarFallback></Avatar>{{ selected.label }}
    </span>
    <template v-else>{{ "Select user..." }}

FAQ

How is the avatar built?

An Avatar at size-5 with AvatarImage for the photo and AvatarFallback with the first letter of the name. The image has an empty alt, since the name is right next to it.

How does the button show the avatar?

It renders the picked person's avatar and name side by side, and Select user... before a pick. The demo finds the user for the current value.

Who is in the list?

Hayden Bleasel, shadcn, Lee Robinson and Guillermo Rauch, with their GitHub pictures.

What shows while an image loads?

The fallback letter, until the image has loaded. If it never loads, the letter stays.

How do I show more about each person?

Add an email or role under the name, as in Items with Metadata.

API Reference

Combobox

Sets collection="collection", input-value-change="handleInputValueChange", value-change="handleValueChange", positioning, getAnchorElement and class. The rest is on the Combobox page.

Avatar

Sets alt="" and src="selected.avatar". The rest is on the Avatar page.