Chat Widget
A standalone, embeddable chat widget for adding agent-powered chat to any web application. Available as a sub-export of @amodalai/react.
Installation
npm install @amodalai/reactQuick Start
import { ChatWidget } from '@amodalai/react/widget'
import '@amodalai/react/widget/style.css'
function App() {
return (
<ChatWidget
serverUrl="http://localhost:3847"
appId="app_123"
position="floating"
/>
)
}Positions
| Position | Behavior |
|---|---|
inline | Renders in-place within your layout |
floating | Floating button that expands into a chat panel |
right | Fixed panel on the right side |
bottom | Fixed panel at the bottom |
Callbacks
<ChatWidget
serverUrl="http://localhost:3847"
onToolCall={(tool, args) => {
console.log(`Agent called: ${tool}`, args)
}}
onKBProposal={(proposal) => {
console.log('Knowledge proposal:', proposal)
}}
/>SSE Events
The widget handles these event types from the runtime:
| Event | Description |
|---|---|
text | Streaming text output |
tool_call | Tool invocation |
skill_activated | Skill activation |
kb_proposal | Knowledge base update proposal |
ConfirmationRequired | Write operation needs approval |
Theming
CSS custom properties — no Tailwind dependency:
.pcw-widget {
--pcw-primary: #6e56cf;
--pcw-background: #ffffff;
--pcw-text: #1a1a1a;
--pcw-border: #e5e5e5;
--pcw-radius: 12px;
}Bundle Size
| Format | Size |
|---|---|
| ESM | ~18KB |
| CSS | ~6KB |