Sahih al-Bukhari Book 33, Hadith 16
Allah's Messenger (ﷺ) used to practice I`tikaf every year in the month of Ramadan. And after offering the
morning prayer, he used to enter the place of his I`tikaf. `Aisha asked his permission to let her practice
I`tikaf and he allowed her, and so she pitched a tent in the mosque. When Hafsa heard of that, she also
pitched a tent (for herself), and when Zainab heard of that, she too pitched another tent. When, in the
morning, Allah's Messenger (ﷺ) had finished the morning prayer, he saw four tents and asked, "What is
this?" He was informed about it. He then said, "What made them do this? Is it righteousness? Remove
the tents, for I do not want to see them." So, the tents were removed. The Prophet (ﷺ) did not perform
I`tikaf that year in the month of Ramadan, but did it in the last ten days of Shawwal.
We practiced I`tikaf with Allah's Messenger (ﷺ) in the middle ten days (of Ramadan). In the morning of the twentieth (of Ramadan) we shifted our baggage, but Allah's Messenger (ﷺ) came to us and said, "Whoever was m I`tikaf should return to his place of I`tikaf, for I saw (i.e. was informed about the date of) this Night (of Qadr) and saw myself prostrating in mud and water." When I returned to my place the sky was overcast with clouds and it rained. By Him Who sent Muhammad with the Truth, the sky was covered with clouds from the end of that day, and the mosque which was roofed with leafstalks of date palm trees (leaked with rain) and I saw the trace of mud and water over the nose of the Prophet (ﷺ) and its tip.
`Umar bin Al-Khattab said, "O Allah's Messenger (ﷺ)! I vowed in the Pre-Islamic period to perform I`tikaf in Al-Masjid-al-Haram for one night." The Prophet (ﷺ) said, "Fulfill your vow." So, he performed I`tikaf for one night.