KokonutUI Logo

AI-02AI

AI Input Search

AI composer with a Tools menu of modes (browse, investigate, draft a visual, run code, reason), a tool header with a Change key, a model picker, an Ask key and a live trace that stacks each source's avatar as it is read. Built with React, Tailwind CSS and Motion.

Install with
lucide-react, motion
Configuring your account...Please wait while we prepare everything for you

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 },
  ]}
/>
PropTypeDefaultDescription
placeholderstring"Ask anything, or type / for tools"Placeholder with no tool picked. Each tool can set its own.
toolsSearchTool[]Browse sources, Investigate, Draft a visual, Run some code, Reason it throughEntries in the Tools menu: id, label, icon, activity, and optional hint, color, placeholder, readsSources, limit.
defaultToolstring | null"browse"Tool picked at first.
modelsstring[]["Opus 5.5", "Sonnet 5.5", "Haiku 5.5"]Entries in the model menu.
defaultModelstring"Sonnet 5.5"Model picked at first.
onSearch(query, { tool, model, files, signal, onSource }) => Promise<void> | void—Runs the request. Omit it for the demo.
classNamestring—Extra classes for the wrapper.

On this page