Skip to main content

MessageInput

The MessageInput component is a React Context provider that does not inject any UI. The MessageInput renders ChatAutoComplete component by default when it does not inject the Input as the props.MessageInputmust be used in the Chat and Channel components.

Basic Usage

tip

If your channelList list is empty, you can create a chat room in createChannel and select it to send messages.

ChatAutoComplete component

As the default render Input component of MessageInpt, ChatAutoComplete gets the sendMessage method through useMessageInputContext, and cannot be used without the MessageInput component.

Use Custom Input

You can render the custom Input component by passing Input as props to the MessageInput.

API

MessageInput

The properties of the MessageInput are described as follows:

PropertyDescriptionTypeDefaultrequired
Inputset your custom Input componentReact.ComponentType-false

ChatAutoComplete

The properties of the ChatAutoComplete are described as follows:

PropertyDescriptionTypeDefaultrequired
placeholderset the placeholderString'Send a Message’false
rowadaptive content heightNumber1false
valueinput contentString‘’false
onChangecallback when the contents of the input changeFunction-false

useMessageInputContext data

PropertyDescriptionTypeDefaultrequired
sendMessageSending message methodFunction--