Add clicking features to label. To be used in forms where normal buttons aren't suitable.
Developed to use case where you want to present values in form with label, but offer edit functionality when clicked. Normal button also reserves caption for itself; where LabelButton leaves presentation of caption to parent layout, and uses value as it's own presentation value. This could be useful in forms where leaving caption out breaks the nice look'n feel of layout.
Add-on has been OSGi bundled.
LabelButton label = new LabelButton("Caption", "Show notification", event -> Notification.show("Clicked!")); // Add-on provides some nice styling out-of-box. There add link style underlining and pointer cursor label.addStyleName(LabelButtonStyles.HOVER_UNDERLINE_WHEN_CLICKABLE); label.addStyleName(LabelButtonStyles.POINTER_WHEN_CLICKABLE); parentLayout.add(label); // .. you can easily jump between normal label and clickable state with label.setClickable(false); // behaves like normal label // .. and label.setClickable(true); // enables all click features and styling
Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.
0.2.0+ version are now for Vaadin 8. Vaadin 7 users should use 0.1.x versions.
- Apache License 2.0
- Vaadin 8.0+
- Vaadin 7.4+ in 0.1.3
- Browser Independent