AI-02AIUpdated, November 16, 2026
AI Input Search
AI composer with a Tools menu (browse, investigate, draft, run code, reason), a model picker and a live trace that stacks each source's avatar as it is read.
Usage
Pick a tool from Tools, or type / in an empty box and press its number, and the Tools pill turns into that tool, tinted with its color. Its x, picking it again, or Backspace in an empty box takes it off. A tool with a limit shows the runs left as dots and locks at zero. With no onSearch the component plays a pretend run. Wire it to your own backend by calling onSource as each source comes in and resolving when the answer is ready. A source shows as a letter avatar in its brand color; pass icon to use a logo instead. Enter or the Ask key sends, and the key turns into Stop while a run is going. Stop, or Esc, aborts signal.
<AI_Input_Search
onSearch={async (query, { tool, model, files, signal, onSource }) => {
if (!tool?.readsSources) {
return ask(query, { tool: tool?.id, model, files, signal });
}
for await (const source of mySearch(query, { deep: tool.id === "investigate", signal })) {
onSource({ domain: source.host, title: source.title });
}
}}
/>Bring your own tools with any Lucide icon:
import { Map } from "lucide-react";
<AI_Input_Search
defaultTool={null}
tools={[
{ id: "places", label: "Find places", icon: Map, color: "#14b8a6", hint: "Maps, hours and reviews", activity: "Looking up places", readsSources: true },
]}
/>PROSearching your docs? Docs Search is in Kokonut UI Pro
Installation
AI Input Search is a free, open-source React component in the Kokonut UI AI collection. Add it with the shadcn CLI, which copies the source into components/kokonutui/ai-input-search.tsx, so the code is yours to change.
npx shadcn@latest add @kokonutui/ai-input-searchOr add it by hand: install its packages, then copy the source from Copy code above into components/kokonutui/ai-input-search.tsx.
npm install lucide-react motionProps
placeholderstringDefault "Ask anything, or type / for tools"toolsSearchTool[]Default built-indefaultToolstring | nullDefault "browse"Tool picked at first. Pass null to start with none.
modelsstring[]Default built-indefaultModelstringDefault "Sonnet 5.5"onSearch(query: string, options: { tool: SearchTool | null; model: string; files: File[]; signal: AbortSignal; onSource: (source: SearchSource) => void }) => Promise<void> | voidRuns the request. Call onSource for each source as it is read, and resolve when the answer is ready; signal aborts on Stop. Without it, the component plays a pretend run so the demo feels alive.
classNamestringExtra classes for the root element.
SearchTool
idrequiredstringlabelrequiredstringShown in the menu and on the chip.
iconrequiredLucideIconactivityrequiredstringWhat the trace says while this tool works, e.g. "Searching the web".
placeholderstringPlaceholder while the tool is picked.
readsSourcesbooleanTrue when the tool reads sources, so the trace stacks them up.
limitnumberRuns left today. The menu shows them as dots and locks the tool at zero.
hintstringOne quiet line under the label in the menu.
colorstringAny CSS color. Tints the icon tile, the pill and the caret.
SearchSource
domainrequiredstringe.g. "developer.mozilla.org"
titlerequiredstringiconReactNodeThe site's mark, e.g. a favicon or logo. Wins over the letter avatar.
colorstringBrand colour for the letter avatar; without it, one is derived.
Dependencies
| Needs | Version | Comes from |
|---|---|---|
lucide-react | ^0.556.0 | npm, installed by the CLI |
motion | ^12.23.25 | npm, installed by the CLI |
textarea | shadcn/ui, added by the CLI | |
dropdown-menu | shadcn/ui, added by the CLI | |
hooks/use-auto-resize-textarea.ts | Kokonut UI, copied by the CLI | |
cn from lib/utils.ts | shadcn init | |
| React | 19 | Your app |
| Tailwind CSS | 4 | Your app |
No provider, font or global CSS to set up: the file works as soon as it lands.

