There are a lot of wrong ways to respond when someone comes out as trans, trans nonbinary, or nonbinary. Some are obviously harmful, such as reacting with violence or hostility. Some are less obvious, such as grieving for the gender you thought that person was, telling them you always knew, or telling them they’d never shown signs prior to coming out. Just as there are many wrong ways to respond, there are many good ways.
When someone comes out to you as trans and/or nonbinary, they are trusting you to accept and support them. The safest and most simple way to respond is to thank them for that trust, and then adapt as quickly as you can to any new pronouns or name/s. Check in with them where and when they want you to use their new name and pronouns, as many trans, trans nonbinary, and nonbinary people come out in stages, or to a limited group of people. Therefore they may not want you using their new name and pronouns around people they are not out to, especially if they never plan on coming out to those people.
Celebration can take many different forms, and not all trans/nonbinary people want fanfare when they come out. A simple way to celebrate is to take the trans/nonbinary person out to dinner, or do something else that you would do for that person if they gave you some good news. Cake is a classic way to celebrate, too.
Throw a “gender repeal” party
You’ve no doubt heard of gender reveal parties, where expectant parents reveal the gender they will be assigning their child. These are controversial in trans spaces, so while some trans people would be delighted if you host them a gender repeal party, it’s best to discuss it with them first.
Offer practical support
A great way to show support is to offer to buy new clothes, take them to get their hair cut, or buy gender affirming items such as binders, gaffs, or pronoun badges. This can also tie in to a gender repeal party, where you can support the person in making a gift wishlist where people can then buy them items to show support, and to help them with whatever form of transition is right for them.
Most importantly –
Ask them what they want
Trans/nonbinary people are no more a monolith than cis people, and what may be welcome to some, may not be to others. Ask them how you can best support them. They may want nothing more than for you to know this part of who they are, or they may want you to help advocate for them, or to affirm their gender in a specific way. They may also not know how they want or need support, in which case it’s good to check in with them later on, and be patient as they learn what they want and need.