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 | 'use client'; |
| 2 | |
| 3 | import { Check, Copy } from 'lucide-react'; |
| 4 | import Image from 'next/image'; |
| 5 | import Link from 'next/link'; |
| 6 | import { useEffect, useRef, useState } from 'react'; |
| 7 | import { cn } from '@/lib/utils'; |
| 8 | |
| 9 | import { SETUP_PROMPT } from '@/lib/agent-prompts'; |
| 10 | |
| 11 | const AGENT_LOGOS = [ |
| 12 | { src: '/images/clients/claude.svg', label: 'Claude' }, |
| 13 | { src: '/images/clients/codex.png', label: 'Codex' }, |
| 14 | { src: '/images/clients/cursor.svg', label: 'Cursor' }, |
| 15 | ]; |
| 16 | |
| 17 | export function AgentSetupActions({ className }: { className?: string }) { |
| 18 | const [copied, setCopied] = useState(false); |
| 19 | const timerRef = useRef<ReturnType<typeof setTimeout>>(undefined); |
| 20 | |
| 21 | useEffect(() => () => clearTimeout(timerRef.current), []); |
| 22 | |
| 23 | const copyPrompt = async () => { |
| 24 | try { |
| 25 | await navigator.clipboard.writeText(SETUP_PROMPT); |
| 26 | clearTimeout(timerRef.current); |
| 27 | setCopied(true); |
| 28 | timerRef.current = setTimeout(() => setCopied(false), 2000); |
| 29 | } catch { |
| 30 | setCopied(false); |
| 31 | } |
| 32 | }; |
| 33 | |
| 34 | return ( |
| 35 | <div className={cn('flex flex-wrap items-center gap-2.5', className)}> |
| 36 | <Link |
| 37 | className="inline-flex min-h-10 items-center rounded-full border border-fd-border bg-fd-card px-5 text-[14px] font-medium text-fd-foreground no-underline transition-colors hover:bg-fd-accent/50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-fd-ring" |
| 38 | href="/docs/agent-setup" |
| 39 | > |
| 40 | Agent setup |
| 41 | </Link> |
| 42 | <button |
| 43 | aria-label="Copy Composio setup prompt" |
| 44 | className="group inline-flex min-h-10 cursor-pointer items-center rounded-full border border-fd-border bg-fd-card py-1 pl-1.5 pr-4 text-[14px] font-medium text-fd-foreground transition-colors hover:bg-fd-accent/50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-fd-ring" |
| 45 | onClick={copyPrompt} |
| 46 | type="button" |
| 47 | > |
| 48 | <span aria-hidden="true" className="mr-3 flex -space-x-1.5"> |
| 49 | {AGENT_LOGOS.map(agent => ( |
| 50 | <span |
| 51 | className="flex size-7 items-center justify-center rounded-full border border-fd-border bg-fd-background" |
| 52 | key={agent.label} |
| 53 | > |
| 54 | <Image alt="" className="size-4 object-contain" height={16} src={agent.src} width={16} /> |
| 55 | </span> |
| 56 | ))} |
| 57 | </span> |
| 58 | <span aria-live="polite">{copied ? 'Prompt copied' : 'Copy prompt'}</span> |
| 59 | {copied ? ( |
| 60 | <Check aria-hidden="true" className="ml-2 size-3.5 text-[var(--composio-brand)]" /> |
| 61 | ) : ( |
| 62 | <Copy |
| 63 | aria-hidden="true" |
| 64 | className="ml-2 size-3.5 text-fd-foreground/45 transition-colors group-hover:text-fd-foreground/70" |
| 65 | /> |
| 66 | )} |
| 67 | </button> |
| 68 | </div> |
| 69 | ); |
| 70 | } |