Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
| 1 | import { Search } from 'lucide-react'; |
| 2 | |
| 3 | export function getKnowledgeSearchHref(query: string): string { |
| 4 | const params = new URLSearchParams({ q: query.trim() }); |
| 5 | return `/kb/search?${params.toString()}`; |
| 6 | } |
| 7 | |
| 8 | interface KnowledgeSearchFormProps { |
| 9 | defaultQuery?: string; |
| 10 | compact?: boolean; |
| 11 | } |
| 12 | |
| 13 | export function KnowledgeSearchForm({ |
| 14 | defaultQuery = '', |
| 15 | compact = false, |
| 16 | }: KnowledgeSearchFormProps) { |
| 17 | return ( |
| 18 | <form action="/kb/search" method="get" className="w-full"> |
| 19 | <label htmlFor="knowledge-search" className="sr-only"> |
| 20 | Search support knowledge |
| 21 | </label> |
| 22 | <div className={`relative flex items-stretch overflow-hidden border border-fd-border bg-fd-background shadow-sm transition focus-within:border-fd-primary focus-within:ring-2 focus-within:ring-fd-primary/20 ${compact ? 'h-12' : 'h-14 sm:h-16'}`}> |
| 23 | <Search className="pointer-events-none absolute left-4 top-1/2 size-5 -translate-y-1/2 text-fd-muted-foreground" aria-hidden="true" /> |
| 24 | <input |
| 25 | id="knowledge-search" |
| 26 | name="q" |
| 27 | type="search" |
| 28 | defaultValue={defaultQuery} |
| 29 | autoComplete="off" |
| 30 | placeholder="Try an action slug, error message, toolkit, or product question" |
| 31 | className={`min-w-0 flex-1 bg-transparent pl-12 pr-4 text-fd-foreground outline-none placeholder:text-fd-muted-foreground ${compact ? 'text-base' : 'text-base sm:text-lg'}`} |
| 32 | /> |
| 33 | <button |
| 34 | type="submit" |
| 35 | className="inline-flex shrink-0 items-center justify-center border-l border-fd-border bg-fd-muted/30 px-5 text-sm font-medium text-fd-foreground transition-colors hover:bg-fd-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-fd-ring sm:px-6" |
| 36 | > |
| 37 | Search |
| 38 | </button> |
| 39 | </div> |
| 40 | </form> |
| 41 | ); |
| 42 | } |