Whenever the Messenger of Allah ﷺ wished to perform itikaf, he would pray the morning prayer and then enter the place where he intended to seclude himself.He once intended to perform itikaf during the last ten days of Ramadan, so he gave orders and a tent was pitched for him. Hafsah also gave orders and a tent was pitched for her. When Zaynab saw Hafsah's tent, she gave orders and a tent was pitched for her as well.When the Messenger of Allah ﷺ saw this, he said, "Is it righteousness you are seeking?" So he did not perform itikaf during Ramadan, and instead performed itikaf for ten days in Shawwal.
أخبرنا أبو داود قال حدثنا يعلى قال حدثنا يحيى بن سعيد عن عمرة
كان رسول الله ﷺ إذا أراد أن يعتكف صلى الصبح ثم دخل في المكان الذي يريد أن يعتكف فيه فأراد أن يعتكف العشر الأواخر من رمضان فأمر فضرب له خباء وأمرت حفصة فضرب لها خباء فلما رأت زينب خباءها أمرت فضرب لها خباء فلما رأى ذلك رسول الله ﷺ قال آلبر تردن فلم يعتكف في رمضان واعتكف عشرا من شوال
Bukhari transmitted it in itikaf, chapter on the itikaf of women, hadith no. 2033, and Muslim in itikaf, chapter on when one who intends itikaf should enter his place of itikaf, hadith no. 6/1173, from the hadith of Yahya bin Saeed Ansari with this same chain, and it is in Kubra, hadith no. 788.