How to create an element with a custom shape

I want to know how to create an element with a custom shape at the point of creation by dragging an element

What did you already try? Where did you get stuck?

Please explain what you’re trying to achieve, Feel free to share screenshots or bits of code for futher clarification.