Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
How to make button act like checkbox? AKA CheckButton, PushButton
I don't want to use Checkbox, I want to use button and have them in pressed mode, (Actually want On/Off switch on Button using Red/Green bulb-icon) ,
I tried switchMode in Button, but then it renders as a CheckBox.
So, Is there anyway, I can keep button in push mode? OR I can render CheckBox as a Button.
(Just for curiosity is there any difference in using CheckBox or Button with switchMode(true)?)
The easiest solution is to create custom component (extend Button or create composite with Button) and implement style switching logic. E.g., 1st click does addStyleName("on"), 2nd click -- removeStyleName("on"), etc. Support for more states (red, green, blue ...) could be implemented the same way.
Or how about just having the checkbox and theme it to look like a button?
Jens Jansson: Or how about just having the checkbox and theme it to look like a button?
One more solution: CustomCheckbox component from the Directory. Allows total control of the look of the checkbox, use images, don't use images. Just CSS.
Chameleon theme's Segment (Button Bar ) makes sense for me :)
And Switch button is cool too..