Window Alignment with respect to button

I have a button component. I want to open a popup/window always aligned to it.

How to do that?

How about using

any documented example or sample on how it looks like etc?

You can find some test cases/examples in

Here’s an online demo as well (all the “Click me” items are PopupViews):