Under Section 3 of the US Constitution's 25th Amendment,adopted in 1967 following the 1963 assassination of President John Kennedy,Trump could declare in writing his inability to discharge his duties.
Vice-President Mike Pence would become acting president,although Trump would remain in office. The president would regain his powers by declaring in writing that he is again ready to discharge them.
The 25th Amendment's Section 4 also offers a path to stripping a president of power if,for instance,his Cabinet believes he has become incapacitated,but this has never been invoked.
Section 3 precedents
On July 13,1985,President Ronald Reagan elected to have a precancerous lesion removed after it was discovered during a colonoscopy. He signed a letter that,while not specifically invoking Section 3,said he was mindful of its provisions. Vice-president George H.W. Bush was acting president for nearly eight hours,from 11.28am until 7.22pm,when Reagan issued a letter declaring himself able to resume his duties.
On June 29,2002,President George W. Bush invoked Section 3,temporarily transferring his powers to vice-president Dick Cheney before undergoing a colonoscopy. Cheney was acting president from 7.09 am to 9.24am.