During the lifetime of the Messenger of Allah (peace be upon him) I was shooting some arrows when an eclipse of the sun tok place. I, therefore , threw them (the arrows) away and said: I must see how the Messenger of Allah ﷺ acts in a solar eclipse today. So I came to him; he was standing (in prayer) raising his hands, glorifying Allah, praising Him, acknowledging that He is the only Deity, and making supplication till the sun was clear. He then recited two surahs and prayed two rak'ahs. (Using translation from Abū Dāʾūd 1195)
بَيْنَمَا أَنَا أَتَرَامَى بِأَسْهُمِي فِي حَيَاةِ رَسُولِ اللهِ ﷺ وَاللهِ إِذْ كُسِفَتِ الشَّمْسُ فَنَبَذْتُهُنَّ وَسَعَيْتُ أَنْظُرُ مَا أَحْدَثَ كُسُوفِ الشَّمْسِ لِرَسُولِ اللهِ ﷺ وَإِذَا هُوَ رَافِعٌ يَدَيْهِ يُسَبِّحُ اللهَ ﷻ وَيَحْمَدُ وَيُهَلِّلُ وَيُكَبِّرُ وَيَدْعُو فَلَمْ يَزَلْ كَذَلِكَ حَتَّى حُسِرَ عَنِ الشَّمْسِ فَقَرَأَ سُورَتَيْنِ وَرَكَعَ رَكْعَتَيْنِ