The Prophet ﷺ performed the Eid prayer and then said, "Whoever wishes to leave may leave, and whoever wishes to stay for the sermon may stay."
حدثنا محمد بن يحيى بن أيوب قال حدثنا الفضل بن موسى قال حدثنا ابن جريج عن عطاء
أن النبي ﷺ صلى العيد قال من أحب أن ينصرف فلينصرف ومن أحب أن يقيم للخطبة فليقم
No references are available.
[Its chain of transmission is hasan] Abu Dawud transmitted it in the Book of Prayer, chapter on sitting for the sermon, hadith 1155, and Ibn Majah, in Establishing the Prayers, chapter on what has been said about waiting for the sermon after the prayer, hadith 1290, from the hadith of Fadl bin Musa with this chain. It is also in Al-Kubra, hadith 1779. Ibn Khuzayma graded it sahih, hadith 1462, as did Hakim, according to the criteria of the two Shaykhs, 1/295, and Dhahabi agreed with him. Refer to Nayl al-Maqsud.