Skip to content

NewMCP server for your coding agent. Set it up ›

Nexus UI
Get Pro

Assign Picker, animated React component

  • Pro
  • Inputs & Controls
  • Spring

An assignee pill with a multi-select menu. Tick people and each avatar flies from its row into the pill, which grows to hold them and stacks them with a count past three; the label reads one name, two names or a number.

Pops when you tick a person and ticks when you untick them. Sound is off on this site until you switch it on.

Props

PropTypeDefaultWhat it does
peoplefive sample peoplePeople in the menu: { id, name, role, colors: [from, to] }. Avatars are gradient circles with initials.
defaultValue[]Ids selected on first render.
onChangeundefinedCalled with the selected ids, in the order they were picked.
autoplayfalseOpens the menu, ticks four people, closes and clears, on a loop until the user clicks.
multipletrueLets several people be ticked. Turn it off and each pick replaces the last and closes the menu.
maxFaces3How many faces the pill shows before the rest collapse into a +N count. Clamped to 1 to 5.
faceSize28Diameter in px of the faces in the pill. Clamped to 22 to 36.
bounce1How much the faces overshoot as they land in the pill. Higher bounces more, lower settles flat. Clamped to 0.5 to 2.
enableSoundtruePlays interface sounds on interaction. They follow the sound switch (setSoundsEnabled, on by default) and stay silent on hover. Autoplay makes the same sounds once the visitor has used the page. Pass false to silence this component.

Add it to your project

  1. 1

    Set up your project once

    You need a Next.js project with Tailwind CSS and the @/ import alias. In its root folder, run this once. It creates components.json and the cn() helper in src/lib/utils.ts:

    npx shadcn@latest init -d

    Starting from nothing? The Quick Start walks through the whole thing.

  2. 2

    Connect the registry with your API key

    Assign Picker is a Pro item, so the CLI has to send your API key. Do this once per project:

    1. Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with nxs_ and is shown only once.
    2. In your project root, next to package.json, create a file named .env.local with this line, using your own key:
      NEXUS_API_KEY=nxs_your_key_here
    3. Open components.json and add this entry inside the outermost braces, next to "aliases". Leave {name} and ${NEXUS_API_KEY} exactly as written; the CLI fills them in:
      "registries": {
        "@nexus-labs": {
          "url": "https://www.nexus-ui.com/api/registry/{name}",
          "headers": {
            "Authorization": "Bearer ${NEXUS_API_KEY}"
          }
        }
      }

Assign Picker questions

How do I install Assign Picker?

Run `npx shadcn@latest add @nexus-labs/assign-picker`. It installs framer-motion. Assign Picker is a Pro component, so it needs a Pro plan and an API key; key setup is on the CLI docs page (/docs/cli).

How do I pass in people?

Pass `people` as `{ id, name, role, colors }`, where `colors` is two colors for the avatar gradient. Avatars are gradient circles with initials drawn on top, so no images are loaded. Without `people` it shows five sample people.

How do I read or preselect the selection?

`onChange` receives the selected ids in the order they were picked, and `defaultValue` sets the ids selected on first render. There is no controlled `value` prop, so the component holds the selection itself.

What does the pill label say?

It reads "Assign" when empty, the first name for one person, "Ana and Ben" style first names for two, and "N people" for three or more. Up to three avatars stack in the pill, with a +N chip beyond that.

Is the menu keyboard and screen reader friendly?

The pill is a button with `aria-haspopup="listbox"` and `aria-expanded`. The menu is a multiselectable listbox whose options carry `aria-selected`. Escape closes the menu and returns focus to the pill.

Does it make sound, and how do I turn it off?

Pops when you tick a person and ticks when you untick them. Sounds are synthesised with the Web Audio API, so there are no audio files, and they only play after a click or key press. Pass `enableSound={false}` to silence this component, or call `setSoundsEnabled(false)` from `@/lib/ui-sounds` to switch every sound off at once. The CLI installs `@/lib/ui-sounds` with the component.