Class MessageInput

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.messages.MessageInput
All Implemented Interfaces:
AttachNotifier, BlurNotifier<MessageInput>, DetachNotifier, Focusable<MessageInput>, FocusNotifier<MessageInput>, HasElement, HasEnabled, HasSize, HasStyle, HasTooltip, Serializable

@Tag("vaadin-message-input") @NpmPackage(value="@vaadin/polymer-legacy-adapter",version="24.6.3") @NpmPackage(value="@vaadin/message-input",version="24.6.3") @JsModule("@vaadin/polymer-legacy-adapter/style-modules.js") @JsModule("@vaadin/message-input/src/vaadin-message-input.js") public class MessageInput extends Component implements Focusable<MessageInput>, HasSize, HasStyle, HasEnabled, HasTooltip
Message Input allows users to author and send messages. The component displays a text-area to input a message and a button to send it. The user can send the message with one of the following actions:
  • by pressing Enter (use Shift + Enter to add a new line)
  • by clicking the ?send? button.
Use the MessageList component to show messages that users have sent.
Author:
Vaadin Ltd.
See Also:
  • Constructor Details

  • Method Details

    • addSubmitListener

      public Registration addSubmitListener(ComponentEventListener<MessageInput.SubmitEvent> listener)
      Adds a listener that is called when the user submits the value of the input field, which can be obtained with MessageInput.SubmitEvent.getValue().

      The event is fired when clicking the Send button or pressing the Enter key.

      Parameters:
      listener - the listener
      Returns:
      registration for removal of the listener
    • getI18n

      public MessageInputI18n getI18n()
      Gets the internationalization object previously set for this component.

      NOTE: Updating the instance that is returned from this method will not update the component if not set again using setI18n(MessageInputI18n).

      Returns:
      the i18n object or null if no i18n object has been set
    • setI18n

      public void setI18n(MessageInputI18n i18n)
      Sets the internationalization object for this component. It enabled you to customize and translate the language used in the message input.

      Note: updating the object properties after setting the i18n will not update the component. To make the changes effective, you need to set the updated object again.

      Parameters:
      i18n - the i18n object, not null