React SDK
React components for seamlessly integrating Char AI into React applications.Installation
- npm
- yarn
- pnpm
Quick Start
Components
<CharWidget />
The main chat widget component:
Props
| Prop | Type | Default | Description |
|---|---|---|---|
apiKey | string | required | Your site API key |
theme | 'light' | 'dark' | 'auto' | 'auto' | Color theme |
mode | 'embedded' | 'floating' | 'floating' | Display mode |
position | 'bottom-right' | 'bottom-left' | 'bottom-right' | Position |
user | User | undefined | User identification |
colors | Colors | {} | Custom colors |
defaultOpen | boolean | false | Start widget open |
Event Props
| Prop | Type | Description |
|---|---|---|
onOpen | () => void | Called when widget opens |
onClose | () => void | Called when widget closes |
onMessage | (message: Message) => void | Called on new message |
onError | (error: Error) => void | Called on error |

