domino-ui-demo icon indicating copy to clipboard operation
domino-ui-demo copied to clipboard

Please add an example for a context menu button/icon

Open elnicko opened this issue 4 years ago • 0 comments

As per gitter chat room, it would be nice if next to the drop down buttons we had the option to actually trigger a DropDownMenu from a normal button or icon. This allows for more styling options.

The following code compiles and works as expected for a "Kebap-Menu":

element.appendChild(Icons.ALL.dots_vertical_mdi()
                .clickable()
                .apply(self -> {
                    DropDownMenu dropDownMenu = DropDownMenu.create(self);
                    dropDownMenu.appendChild(DropdownAction.create("value 1")
                            .addClickListener(evt -> {})
                    );
                    dropDownMenu.appendChild(DropdownAction.create("value 2")
                            .addClickListener(evt -> {})
                    );

                    self.addClickListener(evt -> {
                        dropDownMenu.open();
                        evt.stopPropagation();
                    });

                }).element());

Please add this to the demo application

elnicko avatar Mar 01 '20 08:03 elnicko