Search code examples
vaadinvaadin24

How to modify Vaadin MessageInput textarea placeholder/button content?


Why there's no direct way to modify the content of MessageInput :

  1. placeholder content of textarea (I want to replace Message with Your query here)
  2. send button text (I want to replace Send with Search)

enter image description here

This has to be dead simple and the whole point of moving away from regular input text with buttons. But now its far more difficult and has to jiggle with CSS and custom javascript to achieve anything.

How do I do this ?


Solution

  • You can call setI18n and then pass a MessageInputI18n object:

    input.setI18n(new MessageInputI18n().setMessage("Java Developer in Seattle").setSend("Search")); 
    

    https://vaadin.com/api/platform/24.4.0.alpha1/com/vaadin/flow/component/messages/MessageInputI18n.html