0

How to I can customize the buttons of vaadin ? I'm trying to set height and width but doesn't work and I try align an image on center of button also and doesn't work.

I'm trying this.

/** css file styles.scss */
.myButton{
       width:60px;
       height:60px;
       border:none;
       text-align:center;
}

/** my button */
Button btnMyButton = new Button();
btnMyButton.setIcon(new ThemeResource("../icons/myicon.png"));
btnMyButton.addStyleName("myButton");

any idea ?

FernandoPaiva
  • 4,410
  • 13
  • 59
  • 118

1 Answers1

1

Creating a button having just an icon is quite easy. If you want hover effects it's getting tricky, therefore you should use the NativeButton.

Button btnLogout = new Button();
btnLogout.setIcon(new ThemeResource("icons/logout.png"));
btnLogout.addStyleName(Reindeer.BUTTON_LINK); // define it as a link button => no borders, just the icon. Every theme has this style-name.
btnLogout.setDescription("Logout"); // set hint
nexus
  • 2,937
  • 3
  • 17
  • 22