Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

TextArea height (rows) starting with 1, then expands

Simon Cerne
2 years ago Jul 02, 2020 12:40pm


Is there a way to set Vaadin TextArea component height (rows) starting with 1 (not by 2 by default), then expanding up to n rows/pixels, with a scrollbar?

Cheers, Simon

Tino Kakoushis
2 years ago Oct 13, 2020 8:26pm
Simon Cerne
2 years ago Oct 14, 2020 6:49am
Jouni Koivuviita
2 years ago Oct 14, 2020 7:11am

This requires a bit of JavaScript to fix. You need to set rows=1 to the internal element (https://github.com/vaadin/vaadin-text-field/blob/master/src/vaadin-text-area.html#L63)

There’s an old issue regarding this, that you can vote (👍): https://github.com/vaadin/vaadin-text-field/issues/229

An alternative is to use the "textarea" slot, and place your own element there:</p>

	<textarea slot="textarea" rows="1"></textarea>
Heinz Grams
2 years ago Mar 12, 2021 12:17pm
Olli Tietäväinen
2 years ago Mar 12, 2021 1:49pm