The Book of the Prohibited actions

Riyad as-Salihin · Chapter 289

Things not to be Considered as Showing off

باب ما يُتوهم أنه رياء وليس هو رياء

A sincere person can worry too much. After doing something good, others praise you, and a quiet fear creeps in: was that riya, showing off? This short chapter sets that fear to rest. The key word is riya, doing a deed so that people will see and admire it. The poison of riya is in the intention at the start, not in the praise that may arrive afterward.

Notice the relief in the Prophet's answer. Praise you did not seek, for a deed you did for Allah, is not a stain on it. It is a gift, an early sign of Allah's pleasure carried to you through the tongues of others. The lesson is to guard your intention and then leave the reaction of people to Allah.

Hadith 1621

Abu Dharr (May Allah be pleased with him) said:

وعن أبي ذر رضي الله عنه قال‏:‏ قيل لرسول الله صلى الله عليه وسلم ‏:‏ أرأيت الرجل يعمل العمل من الخير، ويحمده الناس عليه‏؟‏ قال‏:‏ ‏ "‏ تلك عاجل بشرى المؤمن‏" ‏ ‏(‏‏(‏رواه مسلم‏)‏‏)‏‏.‏

The Messenger of Allah (ﷺ) was asked: "Tell us about a person who does some good deed and people praise him, will this be considered as showing off?" He replied, "This is the glad tidings which a believer receives (in this life)." [Muslim].

In plain words

When someone does a good deed for Allah and people happen to praise him, this is not showing off but a welcome glad tiding for the believer. Praise you did not seek does not spoil a sincere deed.

Reference : Riyad as-Salihin 1621 In-book reference : Book 17, Hadith 111