The law in Islam is based upon these four main sources:
The Qur'an
The Sunnah
Sunnah is the traditions or known practices of the Prophet Muhammad, many of which have been recorded in the volumes of Hadith literature. The resources include many things that he “said, did, or agreed to” and he lived his life according to the Qur'an, putting the Qur'an into practice in his own life.
During his lifetime, the Prophet's family and companions observed him and shared with others exactly what they had seen in his words and behaviors - i.e. how he performed ablutions, how he prayed, and how he performed many other acts of worship. People also asked the Prophet directly for rulings on various matters, and he would pronounce his judgment. All of these details were passed on and recorded, to be referred to in future legal rulings. Many issues concerning personal conduct, community and family relations, political matters, etc. were addressed during the time of the Prophet, decided by him, and recorded. The Sunnah can thus clarify details of what is stated generally in the Qur'an.