First thing first. They are called dwarfs, not dwarves. A dwarf is by definition a small creature from fairyland with some, although often
very limited, magical powers. Most dwarfs live in the woods and mind their own business. They don't like people, especially if people explore 'their' area where dwarfs look for all kinds of
treasures.
Dwarfs are particularly fond of gold but they like diamonds and other precious minerals as well. They are masters of mining and can find treasures in virtually every condition. When they get in
possession of something valuable they jealously guard it and are able to hide it for centuries.
From tradition, the leprechauns borrow some characteristics of other small people like aos si, clurichaun, or far darrig. Seven dwarfs from Snow White are, on the other hand, maybe based on real people and real places (it helped to be to be of short statue and it was definitely crucial to be strong for a miner).
Apart from obvious dwarfs known from the classic fairy tales and legends we can also find them in some unexpected places. They are obviously so useful, editors, translators, and illustrators sometimes felt they should include them in the plot even they were not present in the 'original'.
One such example is an addition of an evil dwar in already ominious story of Bluebeard.
In the almost unknown (we hope to improve that) book The Six Wives of Bluebeard a dwarf enters the scene to help the master who is already a bit tired from all the killing. The pictures above (signed by George Cruikshank, but not the famous one) show him with wives number five and six.
Of course not all the dwarfs are bad. The one below is help the good fairy in The Sleeping Beauty adapted by Grace Rhys and illustrated by Robert Anning Bell. When the baby girl is cursed, the evil fairy promises her death and the good one can soften the curse into a long sleep. But to make this sleep useful everybody should sleep as long as the girl. If not, she would wake into a strange world where everybody from her life before sleep would be dead.
So a dwarf wit seven-miles-boots checks as soon as she pricks her finger runs to the fairy who cames to the rescue.