SendButton

Renders the send button inside MessageInput. This is the default component for the SendButton prop.

Best Practices

  • Disable the button when the input is invalid or the channel is disabled.
  • Use sendMessage from context to keep behavior consistent.
  • Keep the button visually distinct but not distracting.
  • Avoid side effects in render; handle send in the handler only.
  • Override via Channel prop instead of modifying internal components.

Props

disabled

True if channel is frozen and disableIfFrozenChannel is true.

Type
Boolean

sendMessage

Sends a composed message within MessageInput component to channel. This function is attached to onPress handler of SendButton. The message optimistically gets added to message list UI first, before actually making API call to server. During this intermediate stage, MessageStatus component will display an indicator for "pending" state.

Type
Function

The function takes an object as a parameter with the following properties:

ParameterDescription
localMessageContains the message data that will be shown in the UI immediately
messageContains the data that will be sent to the backend
optionsContains options for sending/updating the message