Imam al-Shafi'i (may Allah have mercy on him) said in the narration of al-Buwayti: "The basis of kafa'ah (equality in marriage) is derived from the hadith of Sayyidah Barirah (may Allah be pleased with her): her husband was not her kuf' (equal), so the Messenger of Allah (peace and blessings be upon him) gave her the choice (to keep or end the marriage)."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب النكاح / Q13756