Composer
The Composer component is where the user writes messages before sending them to the bot. It provides a text area for input, file uploads, and a speech-to-text option.
import { Composer, useWebchat } from '@botpress/webchat'
function App() {
const { client, clientState } = useWebchat({ clientId: '$CLIENT_ID$' }) // Insert your Client ID here
return (
<Composer
disableComposer={false}
isReadOnly={false}
allowFileUpload={true}
connected={clientState !== 'disconnected'}
sendMessage={client?.sendMessage}
uploadFile={client?.uploadFile}
composerPlaceholder="Type a message..."
showPoweredBy={true}
footer={'[⚡️ by Botpress](https://botpress.com/?from=webchat)'}
/>
)
} Although you can use the Composer as a standalone component, we recommend using it within the
Container component and alongside the Header and MessageList components.
Props
disableComposer boolean
isReadOnly boolean
allowFileUpload boolean
connected boolean
sendMessage (payload: Message) => void
uploadFile (file: File) => Promise<{ fileUrl: string; name: string; type: FileType }>
composerPlaceholder string
footer string
inputRef Ref<HTMLTextAreaElement>