Let the user know that something is being loaded.

I want to let the user know when something is loading. E.g. when a form is being submitted, when the page is loading, etc.

I'm open for it to be a spinner, a progress bar, or whatever.

What are the different ways to show the user a loading status and what libraries are there for that?