Loading...
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
TUTORIAL

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

resize button when wrap text

alfa gaviota
7 years ago Jul 15, 2015 8:46am
Joacim Päivärinne
7 years ago Jul 17, 2015 10:58am

Java

Button btn = new Button(
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
btn.addStyleName("multi-line");
btn.setWidth("100%");

SCSS

.v-button.multi-line {
  height: auto;
  white-space: normal;
}
alfa gaviota
7 years ago Jul 17, 2015 11:40am

Thousands of thanks!!!!! It works fine!!!!

EDIT: If someone needs:
With Joacim's code, the padding of the button is smaller than normal button, but it can be resized in CSS:

.v-button.multi-line {
    white-space: normal;
    height: auto;
    padding-top: 10px;
    padding-bottom: 10px;
}
Gopinath A
7 years ago Jul 23, 2015 6:15am
alfa gaviota
7 years ago Jul 23, 2015 8:26am
Gopinath A
7 years ago Jul 23, 2015 3:25pm
alfa gaviota
7 years ago Jul 24, 2015 10:06am