A select with icons, descriptions, groups, search and multiple choice - for when a native select is not enough.
Used for
- Pick an assignee
- Choose a model
- Tag a ticket
- Add reviewers
- Search a long list
Examples
Installation
npx knowns-ui@latest add comboboxFor Claude Code, Cursor or Codex: installs it and wires the props to your own data.
Paste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install prompt
Install Combobox from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/combobox
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add combobox
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- lib/knowns/motion.tsx
- lib/knowns/motion-utils.ts
- components/ui/knowns/use-floating.ts
- components/ui/knowns/tooltip.tsx
- components/ui/knowns/tooltip-utils.ts
- components/ui/knowns/avatar.tsx
- components/ui/knowns/spinner.tsx
- components/ui/knowns/button.tsx
- components/ui/knowns/dialog.tsx
- components/ui/knowns/kbd.tsx
- components/ui/knowns/field-class.ts
- components/ui/knowns/textarea.tsx
- components/ui/knowns/chat-composer/use-autosize.ts
- components/ui/knowns/input.tsx
- components/ui/knowns/menu.tsx
- components/ui/knowns/tag.tsx
- components/ui/knowns/combobox.tsx
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0, class-variance-authority@^0.7.1.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/combobox, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "combobox" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.Props
- options
ComboboxOption[]- { value, label, supportingText?, description?, keywords?, icon?, avatar?, dot?, disabled?, group? }. Same group → listed together under a header. keywords match the search without being shown.
- option visuals
avatar: string|ReactNode · dot: true|tone · icon- One leading visual per row (avatar, then dot, then icon); the chosen one also shows in the trigger. A string avatar is an image URL.
- supportingText / description
string- Muted text inline after the label (also searched), or a second line under it.
- value / defaultValue / onValueChange
string|null - or string[] with multiple- Controlled or not. Single choice closes on pick; multiple stays open and toggles.
- multiple + display
"summary"|"tags"- Default
"summary" - Summary: first label and +N, Clear / Done footer. Tags: removable chips in the field with an inline search; Backspace removes the last.
- searchable
boolean- Default
false - Search field at the top filters by label and supporting text (case and accents ignored); result counts are announced politely.
- size
"sm"|"md"|"lg"- Default
"md" - 28, 32 or 36px, the same scale as Input, Select and Button.
- icon
ReactNode- Leading glyph in the trigger when the chosen option has no visual (or nothing is chosen).
- placeholder / emptyText
string / ReactNode- Default
"Select…" / "No results" - Trigger text with no value; text when nothing matches.
- id / name
string- id goes on the focusable control so <Field id> labels it; name submits the value(s) as hidden inputs.
- disabled / invalid
boolean- Default
false - Invalid uses the field's red ring. Field's aria-describedby / aria-invalid / aria-required land on the control.
- presentation
"popover"|"dialog"|"auto"- Default
"popover" - Dialog: a modal (bottom sheet below 640px) with a search field and the same rows; multiple keeps a draft until Done, Escape / Cancel discard it. Auto: dialog below 640px or on touch.
- dialogTitle / dialogDescription
ReactNode- Default
aria-label / label - Heading and description of the dialog presentation.
- aria-label
string- Needed only without a Field / <label for>. Keys: ↓ Enter Space open, ↑ opens at the end, ↑↓ PageUp PageDown move, Enter picks, Escape closes.
| Prop | Type | Default | Description |
|---|---|---|---|
| options | ComboboxOption[] | - | { value, label, supportingText?, description?, keywords?, icon?, avatar?, dot?, disabled?, group? }. Same group → listed together under a header. keywords match the search without being shown. |
| option visuals | avatar: string | ReactNode · dot: true | tone · icon | - | One leading visual per row (avatar, then dot, then icon); the chosen one also shows in the trigger. A string avatar is an image URL. |
| supportingText / description | string | - | Muted text inline after the label (also searched), or a second line under it. |
| value / defaultValue / onValueChange | string | null - or string[] with multiple | - | Controlled or not. Single choice closes on pick; multiple stays open and toggles. |
| multiple + display | "summary" | "tags" | "summary" | Summary: first label and +N, Clear / Done footer. Tags: removable chips in the field with an inline search; Backspace removes the last. |
| searchable | boolean | false | Search field at the top filters by label and supporting text (case and accents ignored); result counts are announced politely. |
| size | "sm" | "md" | "lg" | "md" | 28, 32 or 36px, the same scale as Input, Select and Button. |
| icon | ReactNode | - | Leading glyph in the trigger when the chosen option has no visual (or nothing is chosen). |
| placeholder / emptyText | string / ReactNode | "Select…" / "No results" | Trigger text with no value; text when nothing matches. |
| id / name | string | - | id goes on the focusable control so <Field id> labels it; name submits the value(s) as hidden inputs. |
| disabled / invalid | boolean | false | Invalid uses the field's red ring. Field's aria-describedby / aria-invalid / aria-required land on the control. |
| presentation | "popover" | "dialog" | "auto" | "popover" | Dialog: a modal (bottom sheet below 640px) with a search field and the same rows; multiple keeps a draft until Done, Escape / Cancel discard it. Auto: dialog below 640px or on touch. |
| dialogTitle / dialogDescription | ReactNode | aria-label / label | Heading and description of the dialog presentation. |
| aria-label | string | - | Needed only without a Field / <label for>. Keys: ↓ Enter Space open, ↑ opens at the end, ↑↓ PageUp PageDown move, Enter picks, Escape closes. |
What it handles
- 01Opens a listbox under the field with options that carry an icon, an avatar, a status dot, supporting text, a description and a group header.
- 02Filters as you type in a search field by label, supporting text and hidden keywords, ignoring case and accents.
- 03Runs in single mode, or in multiple mode with a summary trigger showing the first label and a count and Clear and Done in the footer, or display tags with removable chips and Backspace to remove the last.
- 04Moves with the arrows, Home, End, PageUp and PageDown, picks with Enter, and closes with Escape, with aria-activedescendant following the active option.
- 05Presents as a popover, as a modal Dialog with a search field, or auto, which picks the dialog below 640px or on touch.
- 06Submits one hidden input per selected value when name is set, and shows emptyText, default No results, when nothing matches.
States
- First render
- Nothing. The trigger shows the chosen value or the placeholder
- none
- Popover open
- The list fades in under the field
- 120ms, opacity only
- Active option
- The highlight is placed on the row at once and does not glide
- none, at once
- Dialog open
- The dialog shows with a search field; multiple choices wait for Done
- none
- Footer buttons
- Clear and Done change colour on hover
- 120ms, ease out
- Reduced motion
- The popover appears at once
- 0ms
| State | What moves | Timing |
|---|---|---|
| First render | Nothing. The trigger shows the chosen value or the placeholder | none |
| Popover open | The list fades in under the field | 120ms, opacity only |
| Active option | The highlight is placed on the row at once and does not glide | none, at once |
| Dialog open | The dialog shows with a search field; multiple choices wait for Done | none |
| Footer buttons | Clear and Done change colour on hover | 120ms, ease out |
| Reduced motion | The popover appears at once | 0ms |
Works with
- AvatarInstalled with it. An option's avatar string renders as a small circular Avatar.
- TagInstalled with it. Tags display uses Tag for each removable chip in the field.
- DialogInstalled with it. The dialog presentation opens the options as a modal or a bottom sheet.
- MenuInstalled with it. The glide highlight, check mark and typeahead matching are shared with Menu.
When to use
When to use
- Picking one or many values from a long list with search, icons, avatars or groups.
When not to use
- A few plain options: use Select.
- Choosing a model with price and context details: use Model Picker.
Using with AI
Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:
- Add the Knowns UI Combobox to my app and wire it to my own data.
- I need picking one or many values from a long list with search, icons, avatars or groups. Set that up with the Knowns UI Combobox.
- Which Combobox props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "combobox" }) and search_docs({ query: "combobox" }).