How to make MacBook notifications fade by themselves?

Currently, notifications appear in the top right corner, and never go away by themselves.

How to make notifications fade after 30 seconds?


Solution 1:

It depends on what type of notification it is.

Alerts stay until you dismiss them.
Banners stay a short while, then auto-close.

enter image description here

This is Mojave. Big Sur is similar, just with some slight visual differences.