Class MessageInput

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

@Tag("vaadin-message-input") @JsModule("@vaadin/message-input/src/vaadin-message-input.js") @NpmPackage(value="@vaadin/message-input", version="25.0.0-alpha20") public class MessageInput extends com.vaadin.flow.component.Component implements com.vaadin.flow.component.Focusable<MessageInput>, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.shared.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:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    The submit event which is fired by MessageInput component.

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier

    com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier

    com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component>
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new message input component.
    MessageInput(com.vaadin.flow.component.ComponentEventListener<MessageInput.SubmitEvent> listener)
    Creates a new message input component with the provided listener that gets invoked when the user submits a new message.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.vaadin.flow.shared.Registration
    addSubmitListener(com.vaadin.flow.component.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().
    Gets the internationalization object previously set for this component.
    void
    Sets the internationalization object for this component.

    Methods inherited from class com.vaadin.flow.component.Component

    addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisible

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.BlurNotifier

    addBlurListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.Focusable

    addFocusShortcut, blur, focus, getTabIndex, setTabIndex

    Methods inherited from interface com.vaadin.flow.component.FocusNotifier

    addFocusListener

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasEnabled

    isEnabled, setEnabled

    Methods inherited from interface com.vaadin.flow.component.HasSize

    getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull

    Methods inherited from interface com.vaadin.flow.component.HasStyle

    addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName

    Methods inherited from interface com.vaadin.flow.component.shared.HasTooltip

    getTooltip, setTooltipText
  • Constructor Details

    • MessageInput

      public MessageInput()
      Creates a new message input component.
    • MessageInput

      public MessageInput(com.vaadin.flow.component.ComponentEventListener<MessageInput.SubmitEvent> listener)
      Creates a new message input component with the provided listener that gets invoked when the user submits a new message.
      Parameters:
      listener - the submit event listener
      See Also:
  • Method Details

    • addSubmitListener

      public com.vaadin.flow.shared.Registration addSubmitListener(com.vaadin.flow.component.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