While we were sitting in the mosque, the Messenger of Allah ﷺ came out to us carrying Umama, the daughter of Abu al-As bin Rabi. Her mother was Zaynab, the daughter of the Messenger of Allah ﷺ. She was a small child whom he was carrying. The Messenger of Allah ﷺ prayed while she was on his shoulder, setting her down when he bowed and lifting her back up when he stood, until he finished his prayer, doing this with her throughout.
أخبرنا قتيبة قال حدثنا الليث عن سعيد بن أبي سعيد عن عمرو بن سليم الزرقي أنه سمع
بينا نحن جلوس في المسجد إذ خرج علينا رسول الله ﷺ يحمل أمامة بنت أبي العاص بن الربيع وأمها زينب بنت رسول الله ﷺ وهي صبية يحملها فصلى رسول الله ﷺ وهي على عاتقه يضعها إذا ركع ويعيدها إذا قام حتى قضى صلاته يفعل ذلك بها
Muslim narrated it in the Book of Mosques, Chapter on the Permissibility of Carrying Children During Prayer, Hadith: 543, from Qutayba. Bukhari narrated it in the Book of Manners, Chapter on Mercy Toward Children, Kissing and Embracing Them, Hadith: 5996, from the hadith of Layth bin Saad through him. It is also found in Kubra, Hadith: 790.