Container
The Container wraps the core Webchat interface.
It manages:
- Layout
- Drag-and-drop file uploading
- Connection status feedback
It also provides a shared context for nested components like MessageList and Composer.
import { Container, useWebchat } from '@botpress/webchat'
function App() {
const [isWebchatOpen, setIsWebchatOpen] = useState(false)
const { clientState } = useWebchat({
clientId: '$CLIENT_ID$', // Insert your Client ID here
})
return (
<Container
connected={clientState !== 'disconnected'}
style={{
width: '500px',
height: '800px',
display: isWebchatOpen ? 'flex' : 'none',
position: 'fixed',
bottom: '90px',
right: '20px',
}}
>
// Your Webchat content goes here
</Container>
)
} Props
connected boolean
allowFileUpload boolean