Ayesha reported,

The Messenger of Allah ﷺ fell ill, and some of his companions came to visit him. The Prophet ﷺ prayed while sitting, and they prayed behind him standing. He gestured to them to sit down.When he finished, he said, "The imam is appointed only to be followed. When he bows, bow. When he rises, rise. And when he prays sitting, pray sitting."

Ibn Majah 1237

Sahih

حدثنا أبو بكر بن أبي شيبة حدثنا عبدة بن سليمان عن هشام بن عروة عن أبيه

عن عائشة قالت

اشتكى رسول الله ﷺ فدخل عليه ناس من أصحابه يعودونه فصلى النبي ﷺ جالسا فصلوا بصلاته قياما فأشار إليهم أن اجلسوا فلما انصرف قال إنما جعل الإمام ليؤتم به فإذا ركع فاركعوا وإذا رفع فارفعوا وإذا صلى جالسا فصلوا جلوسا

ابن ماجه 1237صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Ibn Majah
Book
Establishing prayer and the sunnah regarding it
Chapter
Imam is appointed to be followed
Numbering
Darussalam 1237
Ibn Majah 1237