MessageInput component displays an input where users can type their messages and upload files, and sends the message to the active channel. The component can be used to compose new messages or update existing ones. To send messages, the chat user needs to have the necessary channel capability.
The SDK doesn't have a built-in emoji picker, but it has support for providing your own template. Follow our emoji picker guide to get to know more.
If you want to provide your own message input component you'll have to provide it in the following places:
- Replace the default message input inside the channel
- Replace the default message input inside the thread
- Provide your own messageInputTemplate$ to the
See our customization guide for more information.
If you want to create your own message input, you can use the following building blocks:
Send and update messages
You can use
ChannelService to send and update messages.
You can use the
AttachmentService to manage file uploads.
If more than one message input component can exist on your chat UI you should provide the
AttachmentService on the component level:
Inputs and outputs
If file upload is enabled, the user can open a file selector from the input. Please note that the user also needs to have the necessary channel capability. If no value is provided, it is set from the
The scope for user mentions, either members of the current channel of members of the application. If no value is provided, it is set from the
Determines if the message is being dispalyed in a channel or in a thread.
If true, users can select multiple files to upload. If no value is provided, it is set from the
The message to edit
An observable that can be used to trigger message sending from the outside
desktop mode the
Enter key will trigger message sending, in
mobile mode the
Enter key will insert a new line to the message input. If no value is provided, it is set from the
Enables or disables auto focus on the textarea element
Emits when a message was successfuly sent or updated