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.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Textfield - textarea - input type text
From what I can see a Textfield can be rendered as either a textarea or an input type text (one row). If I make a Textfield and want to make sure it's made as an input type text, what do I need to do? setRow(1) does not seem to work.
Cheers,
Lars
I guess you just create a new TextField and don't touch setRows, setHeight and setMultiLine methods at all, and you should be fine.
Hi Lars,
can you post a self-contained example which shows the problem? If you just use a TextField (with no setRows() or setSizeFull()) it should be a single-line textfield.
I've just tested that calling setSizeFull() on a TextField (with no rows set) might give you a single-line html-"textarea" (which is obviously not want you want). Not sure if this is by design or a bug.
Cheers, Maik
Thanks, it seems that if I set height on the field it automatically renders as a textarea.
Hi,
Seems like is sufficient to you set the height from css for the TextField to be rendered as a TextArea.
Worked for me :)
I want the TextField to fill the cell of its parent grid layout, without it being a multi-line TextArea. I tried to use setSizeFull to make it fill the cell, and it turned into a multi-line TextArea. How can I tell it to expand its width and not its height?
Thanks,
David
setWidth("100%") should work. Making the height flexible without making it a multiline field you need to use pure CSS.