Prompt user input api

I spent hours looking for an answer, but unfortunately I couldn’t find it.
Is there a way to prompt the user for input and get what the user entered

In the Obsidian API this is called a modal,
here are a few examples:

Thanks, it helped me a lot!