How to create a modal window?

Hello. Can you please tell me how I can create a browser modal window through the main browser application? At the same time, it should interact with it and receive / send events on any changes.

Have you considered using a library like Bootstrap to build something?