How to render the selected element inside the plugin interface?

I am creating a plugin but I could not find how to render the selected element inside the plugin interface like it is in the screenshot. Can anyone help me with this?

Export the selection to an image and send it to the UI.

API reference:

Worked. Thanks!