Abdullah bin Abbas reported,

The Prophet ﷺ took one of his daughters who was dying and embraced her, placing her against his chest, and she passed away there between his breasts. Umm Ayman cried out, and someone said to her, "Do you weep in the presence of the Messenger of Allah ﷺ?"She replied, "Do I not see you weeping, Messenger of Allah?"He said, "I am not weeping. This is only mercy. Truly, the believer is in a state of goodness in every condition. Even as his soul departs from between his sides, he is praising Allah عز وجل."

Azami 3590

Sahih

عن ابن عباس قال

أخذ النبي ﷺ بنتا له تقضي فاحتضنها، فوضعها بين ثدييه فماتت وهي بين ثدييه، فصاحت أم أيمن فقيل: أتبكي عند رسول الله ﷺ؟ قالت: ألست أراك تبكي يا رسول الله؟ قال: لست أبكي، إنما هي رحمة، إن المؤمن بكل خير على كل حال، إن نفسه تخرج من بين جنبيه وهو يحمد الله عز وجل.

الأعظمي 3590صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Funerals
Chapter
Prohibition of wailing over the deceased, and permissibility of weeping and showing grief over him
Section
Permissibility of weeping over the deceased and showing grief for them
Numbering
Jami al-Kamil 3590 (2nd edition)
Azami 3590