Incubator Popup - Vaadin Add-on Directory
Incubator Popup for Flow
Incubator Popup for Flow is a server-side component of the incubator-popup web component for Vaadin 10. It provides a popup that can be bound to element by id, and be opened on clicking to target element.
### Usage
After creating new Popup object it should be bound to a target element by calling the method
`setFor(id)` with the id of the target element as parameter. Then after clicking on the target element, the popup will be opened.
Clicking outside of the popup will close it.
```
Popup popup = new Popup();
popup.setFor("id-of-target-element");
Div text = new Div();
text.setText("element 1");
Div text2 = new Div();
text2.setText("element 2");
popup.add(text, text2);
```
If the parameter `closeOnClick` is set to `true`, the popup will be closed also after clicking on the popup.
Opening and closing of the popup can be done programmatically by calling the methods `show()` and `hide()`.
```
Button button = new Button("Show/Hide");
button.addClickListener(e -> {
if (popup.isOpened()) {
popup.hide();
} else {
popup.show();
}
});
```
Setting the parameter `opened` to `true` will open the popup. In case the popup is not yet rendered, it will be opened after rendering.
```
popup.setOpened(true);
```
Source CodeIncubator Popup version 1.0.0
```