Offering condolences is prescribed
The word ta’ziyah means “to console”; it is the verbal noun of the form عَزَى يُعَزِّي (taf’il).
➊ In a narration from Qurrah al-Muzani (may Allah be pleased with him), a child of one of the Companions of the Prophet ﷺ died:
فعزاه عليه ثم قال يا فلان أيما كان أحب إليك أن تمتع به عمرك أو لا تاتي غدا إلى باب من أبواب الجنة إلا وجدته قد سبقك إليه يفتحه له
“So he ﷺ offered him condolences, then said: O so-and-so! Which would you prefer: that you benefit from him (the child) during your lifetime, or that tomorrow, when you come to any of the gates of Paradise, you find him already there ahead of you, and he opens it for you?”
➋ It is narrated from Anas (may Allah be pleased with him) that the Prophet ﷺ said:
من عزى أخاه المؤمن فى مصيبة كساه الله حلة خضراء يـحبـر بـهـا يوم القيمة قيل يا رسول الله ما يحبر؟ قال يغبط
“Whoever consoles his believing brother in a calamity, Allah will clothe him with a green garment by which he will be envied on the Day of Resurrection.”
➌ It is narrated from Ibn Mas’ud (may Allah be pleased with him) that the Prophet ﷺ said:
من عزي مصابا فله مثل أجره
“Whoever consoles one who has been afflicted by a calamity will have a reward like his (the afflicted person’s) reward.”
Words of condolence
For condolence, any words may be used by which consolation is attained, grief is stilled, and patience comes. However, the following words are established from the Prophet ﷺ in a narration from Usamah bin Zayd (may Allah be pleased with him):
إِنَّ لِلَّهِ مَا أَخَذَ وَلَهُ مَا أَعْطى وَكُلُّ شَيْى عِندَهُ بِأَجَلٍ مُسَمًّى فَلْتَصْبِرُ وَلَتَحْتَسِبُ
(Nawawi, may Allah have mercy on him) Among the words with which condolences are offered, this hadith is the finest.