Most alkali metals and alkaline earth metals react with water to produce hydrogen. The alkali metals comprise Group 1 of the periodic table, and include lithium, sodium, potassium, rubidium, cesium and francium. The alkaline earth metals comprise Group 2, and include beryllium, magnesium, calcium, strontium, barium and radium. Beryllium, however, does not react with water, and francium is much too rare and unstable to be relevant to this question. When mixed with water, the alkaline earth metals generally produce a weaker reaction than the alkali metals.
TL;DR (Too Long; Didn't Read)
Most group 1 and group 2 elements react with water to produce hydrogen.
Lithium’s reaction with water is relatively slow and gentle, because its density is roughly half that of water. It fizzes on the water's surface, releasing hydrogen and gradually forming a clear lithium hydroxide solution.
When sodium metal reacts with water, the resulting heat melts the metal almost immediately into a grey-silver ball. The hydrogen gas evolved during this reaction propels the ball rapidly across the surface of the water, leaving a white trail of sodium hydroxide that eventually dissolves into a clear solution. The hydrogen will often self-ignite and burn with an orange flame. Larger pieces of sodium metal may explode in contact with water.
Potassium is a soft, silver-white metal that reacts violently with water to form hydrogen and potassium hydroxide. The heat of this reaction ignites the hydrogen, producing a vigorous bluish-pink flame. Like sodium metal, potassium metal may explode in water.
Rubidium is a soft, very reactive metal that can self-ignite in air. It reacts violently in water, producing hydrogen that ignites from the heat of the reaction, as well as rubidium hydroxide.
Cesium is an extremely reactive silver-gold alkali metal that is liquid at room temperature. It ignites in air and explodes in water, producing hydrogen and cesium hydroxide, which is the strongest base known.
Magnesium occurs in minerals like dolomite, asbestos and soapstone. Elemental magnesium is a light but strong metal. Magnesium generally reacts weakly with water, unless the water is at a high temperature. It will produce hydrogen and magnesium oxide when exposed to steam.
Calcium is the third most common metal on earth (after iron and aluminum), and the fifth most common element in the periodic table. It occurs naturally in compounds like limestone, marble and chalk. When mixed with water, calcium metal generates hydrogen gas and forms a cloudy white solution of calcium hydroxide.
Barium is a soft, silver-white metal that oxidizes rapidly in air, and occurs naturally only in combination with other elements. It reacts quickly with water to form barium hydroxide and hydrogen.
Like barium, strontium is a silver-white metal that oxidizes rapidly in air. When placed in water, strontium sinks; after a short time, bubbles of hydrogen appear on the surface of the metal. The reaction of strontium with water forms strontium hydroxide and hydrogen.
Radium is a whitish radioactive metal that reacts quickly with the nitrogen in air to form a black nitride layer. Formerly used in medicines to treat cancer and other diseases, its use declined as researchers discovered safer materials. Radium decomposes rapidly in water, producing radium hydroxide and hydrogen.