Skip to main content
React Chatbot SDK

Build your own React chatbot UI

Connect React components to ChattyBox with @openstaticfish/chattybox. Your team controls rendering and state while managed infrastructure handles source-grounded answers, citations, and conversation continuity.

Crawls published docs pages
Source-cited answers
Embeds with one script
No docs migration required
No credit card requiredYour content stays yours
Ask ChattyBox
x
Where should I start if I need a reliable answer from this site?
Start by adding your website URL to ChattyBox. It crawls your content, answers from the pages it finds, and shows visitors the sources behind each response.
iSources3^
React guide
chattybox.ai
Analytics
chattybox.ai
Home
chattybox.ai
Ask a question...
Powered by ChattyBox
Built for React product teams

Launch a source-cited chatbot without rebuilding your docs stack

ChattyBox crawls your existing documentation, indexes the content for retrieval, and embeds a chatbot that answers using your docs instead of generic model memory.

Create custom message, citation, loading, fallback, and error components.
Keep conversation IDs in visitor-scoped React state for follow-up questions.
Use public origin-restricted API keys safely in browser applications.
Avoid maintaining your own crawler, vector store, retrieval service, or generation pipeline.
Workflow step

Install the JavaScript SDK in your React application.

Workflow step

Create one Chattybox client outside the component render path.

Workflow step

Send messages from an event handler and update UI state with the response.

Workflow step

Render source links and handle structured ChattyboxError failures.

Three-step launch

Paste your React URL, test cited answers, then install the widget.

Build a React chatbot
React integration

Fit grounded chat into your existing component system

Use the state, accessibility, styling, and design-system patterns your application already follows instead of adapting to a fixed widget shell.

01

Component ownership

Compose messages, citation cards, prompts, empty states, and controls from your own React components.

02

State on your terms

Use local state or your existing state layer while keeping conversations isolated between visitors.

03

Accessible responses

Control focus, live regions, keyboard behavior, and error announcements within your application.

04

Managed backend

Keep the browser integration small while ChattyBox handles content indexing, retrieval, and cited answers.

Install path

Connect a React component to ChattyBox

Create the client once, call it from an event handler, and keep each visitor conversation ID in component or application state.

  1. 1Add @openstaticfish/chattybox to the React application.
  2. 2Initialize the client with Vite or framework-provided public environment variables.
  3. 3Store the returned message, sources, and conversation ID in visitor-scoped state.
Build a React chatbot
Chat.tsx
tsx
import { useState } from 'react';
import { Chattybox } from '@openstaticfish/chattybox';

const chattybox = new Chattybox({
  apiKey: import.meta.env.VITE_CHATTYBOX_API_KEY,
  baseUrl: import.meta.env.VITE_CHATTYBOX_API_URL,
});

export function Chat() {
  const [answer, setAnswer] = useState('');

  async function ask(message: string) {
    const response = await chattybox.sendMessage({ message });
    setAnswer(response.message);
  }

  return <div aria-live="polite">{answer}</div>;
}
FAQ

Common questions

1

Can I build a custom React chatbot with ChattyBox?

Yes. The JavaScript SDK returns messages, conversation IDs, and source URLs so your React application can render a completely custom interface.

2

Does ChattyBox provide a React component?

The SDK is intentionally headless. This lets teams use their own component library, accessibility behavior, state management, and product design.

3

Where should I create the Chattybox client in React?

Create it once outside the component render path or in a stable application provider rather than constructing a new client for every render.

4

Can I use the hosted widget in React instead?

Yes. Use the hosted widget installation guide when you want a maintained interface rather than custom React rendering.

Start free

No credit card required. Your content is not used for model training.

Create free chatbot

Free tier. No card needed.