Ar-Riya is censured in the Book and the sunnah. From them is the Statement of Allah, the Most High:
"So woe to the worshippers, who are neglectful of their prayers. Those who want to be seen (by men)."
As for the ahadith, some of them have already been mentioned in the chapter of shirk, since ar-riya is the minor shirk. Some will be mentioned here, insha'Allah. Know O Muslim, O slave of Allah, that the word riya is taken from the word ruyah (to be seen). So the one to be seen is viewed by the people as one seeking self-esteem amongst them. So at times one would seek self-esteem by one's actions in this world.
Riya is of many types and forms, its nature and tendency is that it invalidates the actions as stated in the Book and the sunnah. Allah, the Most High, says:
"Like those who spend from their wealth to be seen by men, and they do not believe in Allah and the Last Day. Their example is like the example of a hard rock on which is a little soil, then on it falls heavy rain which flows off it and they will not be able to do anything with whatever they have earned and Allah does not guide the disbelieving people."
The Prophet, sallallahu 'alayhi wa sallam, said:
"What I fear for you the most is the minor shirk, that is ar-riya. Allah will say on the Day of Judgement when He is rewarding the people for their actions: Go to those for whom you did riya for in the world then see if you find the reward with them."
The Prophet, sallallahu 'alayhi wa sallam, said:
"Shall I not inform you of what I fear for you more than the Masih ad-Dajjal? It is the hidden shirk. It is when a man stands up for prayer, then beautifies his prayer for another to look at."
So be warned my brother in faith, from riya as it is an evil tribulation annihilating the actions. Know O Muslim brother, that the Fire will be kindled first for the people who showed-off because they took the enjoyment from the results of their actions in the life of this world. So flee, O slave, from riya as you would flee from a lion, as riya and one's hidden desires even weakened the stands of the senior scholars from its dangers, let alone the general masses.
The scholars and the active worshippers who made great efforts to tread the path to the Hereafter, were even put to trial by it. When they took control of their themselves and abstained from desires, they were not being allured to the apparent and open sins committed by the limbs. However when they became relaxed, they began to pretend to show knowledge, actions and to present gatherings, to be observed by the people with reverence and esteem. They feel great delight and they looked down upon the idea of leaving sins. So one of them thinks that he is from amongst the sincere worshippers of Allah but he has been confirmed as one of the hypocrites. This is a great deception and no one is safe from it except the angels. It was said in a poem:
Enemies of the soul and the Shaytan;
resist them both,
If they both give sincere advice to you,
then escape from them both.
O Allah, Lord of the Heavens and the earth, purify our hearts from hypocrisy and our actions from riya. Make us firm upon Your straight path so that we achieve certainty. Amin.
From Invalidation of Actions