Sparkecode Dev Tools for selecting and sharing components.
npm install sparkecode-devtoolsClick any React component on a page to copy helpful context to your clipboard.
``html`
`tsx
import { SparkeCodeSelect } from 'sparkecode-devtools/next';
export default function Layout({ children }) {
return (
<>
{children}
>
);
}
`
Default behavior:
- Runs only in development
- Auto-connects to a local Sparkecoder instance and sends selections into the latest session
Optional overrides:
`tsx`
scriptUrl="https://unpkg.com/sparkecode-devtools/sparkecode-select.js"
sparkecoderEnabled={true}
config={{
sparkecoder: {
apiBase: "http://127.0.0.1:3141",
sessionId: "your-session-id"
},
primaryColor: "#8b5cf6"
}}
/>
If you are running Sparkecoder locally, you can auto-send selections into the
most recently active session:
`html`
Optional overrides:
`html`
You can set the Sparkecoder server URL via environment variable instead of passing it as a prop:
`bash`In your .env.local
NEXT_PUBLIC_SPARKECODER_DEV_TOOLS_SERVER_URL=http://192.168.1.100:3141
This is useful when your Sparkecoder server is running on a different machine or port.
The component checks for:
1. NEXT_PUBLIC_SPARKECODER_DEV_TOOLS_SERVER_URL (client-side accessible)SPARKECODER_DEV_TOOLS_SERVER_URL
2. (server-side only, for SSR)
You can also pass serverUrl as a prop to override:
`tsx`
You can also send copy events to any endpoint:
`html`
- Click the floating button to toggle selection mode
- Click the panel icon (right side of button) to open the SparkeCode web UI
- Drag the button to reposition
- Press Cmd/Ctrl+Shift+S to toggle selection modeEsc
- Press to exit selection mode
Click the panel icon on the button to open a draggable, collapsible panel showing the full SparkeCode web interface. This lets you see the agent's responses and chat history while working on your app.
- Drag the header to move the panel
- Click the minus button to collapse
- Click the X to close
Configure the web UI URL:
`bash`In your .env.local
NEXT_PUBLIC_SPARKECODER_WEB_UI_URL=http://localhost:6969
Or via prop:
`tsx``
When connected to a running Sparkecoder instance, clicking a component will:
1. Show a prompt input
2. Let you type what you want to do with the component (e.g., "make this button red")
3. Press Enter to send the request + component context directly to the agent
4. The agent will start working immediately
If you leave the prompt empty and press Enter, it sends just the component context.
Press Esc or click outside to cancel.