# Persona picker

Choose which agent answers, right from the composer: @ mentions, a searchable picker, and each agent's model and tools before you send.

> chatcn Pro: needs a Pro license (https://chatcn.dev/pro). Install from the `@chatcn-pro` registry with your license token; setup at https://chatcn.dev/docs/chatcn-pro.

Example: Persona picker. A furniture shop's workspace with five agents. @led switches to the finance agent, and the question goes to Ledger. Preview: https://chatcn.dev/preview/persona-picker-demo

## Installation

```bash
npx shadcn@latest add @chatcn-pro/persona-picker
```

## Usage

```tsx
import { PersonaPicker } from "@/components/ui/chatcn/pro/persona-picker"

<PersonaPicker
  personas={[
    { id: "general", name: "Assistant", role: "General help", model: "claude-sonnet-5-5" },
    { id: "ledger", name: "Ledger", role: "Finance analyst", model: "claude-opus-5-5" },
  ]}
  defaultPersona="general"
  onSubmit={({ text, persona }) => send(persona, text)}
/>
```

A To line above the text says who will answer and on which model, so nobody sends a finance question to the support agent by accident. Typing @ at the start of a word opens the agents inline and filters as you type, by name first and then by role; Enter or Tab picks, and the mention is removed from the text. The toolbar button opens the same list as a picker with search. Hovering or moving through an agent shows what it is for, its model and its tools, and marks the tools that wait for your approval. Picking another agent shows a way back to the default. Under it all is the free `PromptInput`: IME safe Enter, Shift Enter for a new line, paste, and Stop in the send footprint.

## Examples

### Picker

Example: Picker. The picker open from the toolbar. Find an agent, and see its model and tools, with the ones that ask first marked. Preview: https://chatcn.dev/preview/persona-picker-open

### States

Example: States. The default agent, another one picked, @ open inline, filtered by role, no match, streaming and disabled. Preview: https://chatcn.dev/preview/persona-picker-states

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `personas` | `Persona[]` | `{ id, name, role?, description?, model?, tools?, avatar? }`; a tool is `{ name, icon?, access?: "auto" | "asks" }` |
| `persona`, `defaultPersona`, `onPersonaChange` | `string` | Who answers, controlled or not |
| `onSubmit` | `({ text, persona }) => void` | The message and the agent it goes to |
| `defaultPickerOpen` | `boolean` | Open the picker on mount, for previews |
| `value`, `defaultValue`, `onValueChange` | `string` | The draft, controlled or not |
| `status`, `onStop` | `"idle" | "submitting" | "streaming"`, `() => void` | Send becomes Stop in the same footprint |
| `disabled` | `boolean` |  |
| `tools`, `actions`, `attachments` | `ReactNode` | Toolbar start, before Send, above the text |
| `labels` | `Partial<PersonaPickerLabels>` | Every string, for translation |

## Keyboard

| Key | Action |
| --- | --- |
| @ at the start of a word | Open the agents inline, filtered as you type |
| Up, Down | Move through the agents and show each one's detail |
| Enter or Tab | Pick the highlighted agent |
| Escape | Close the list and keep the text |
| Enter, Shift Enter | Send, new line. Never sends while an IME is composing |

## Accessibility

- While the inline list is open the field is a combobox pointing at the highlighted agent.
- The To line names the agent and model in text, so the choice never rests on an avatar alone.
- Tools that ask first carry the words Asks first next to their icon.
- The picker's search field is a combobox over the agent list; Escape closes it and focus returns to the toolbar button.

## Motion

The inline list and the picker open from where they were triggered with a short fade and scale; the detail pane swaps without movement. Under reduced motion both only fade.

Source: https://chatcn.dev/docs/components/persona-picker