There are plenty of ways to leave a party.

You can quietly say your thanks and goodbyes and be on your way. You can stay a while to help clean up. Or you can be a real jerk about it by stomping off and complaining it was a terrible party anyway — even though you drank more than your share of cocktails, scarfed down the fancy food and manspread on the couch.

Unfortunately, too many of San Francisco’s tech leaders are opting for that third option. They scooped up the tax breaks and enjoyed the proximity to talent, universities and capital throughout the decade-long boom. Now, they’re hightailing it to Austin, Miami or elsewhere as soon as the going gets tough.

But that’s not the worst part. The worst part is blasting San Francisco for being such a terrible host as they leave.

Jeff Lawson, founder and CEO of San Francisco’s Twilio, called out his fellow tech titans for not only bailing on the city in the middle of a pandemic, but being rude about it as they leave.

“This is the time when we should be thinking about, ‘How do we give back? How do we help take care of our communities and the people around us who may not be faring as well?’” he told me on The Chronicle’s “Fifth & Mission” podcast. “This is not the time to be dunking on the community.”

Since we could all use a metaphorical shot in the arm — after news of how hard it is to get an actual shot in the arm here in California despite the COVID-19 surge — I invited Lawson to explain his optimism about San Francisco after seeing his recent thread on Twitter that went viral.

“With many of the valley’s richest companies fleeing the Bay Area mid-pandemic, I feel compelled to speak out,” the thread began. “What I take issue with is our leaders — people of means — abandoning our community when it needs us most. Reaping the benefits of Silicon Valley’s talent, tech incubators, mentors, professional network and culture until they no longer need it.”

He said he’s keeping his family and company in San Francisco and called on his fellow tech leaders to #committothebay. He also pledged $8 million to Help Kitchen, a nonprofit that pays restaurants to provide meals to hungry people. Records show he also gave $500,000 to the city’s Give2SF fund to provide pandemic relief.

He explained that he understands why many people and companies are leaving San Francisco and the Bay Area: lower taxes, more house and backyard for your buck, less crime and misery on the streets, remote work allowing connections anywhere.

But he objects to the nastiness as they go — especially because many tech companies have thrived during the pandemic as their teams could easily work from home and their technology became more crucial and lucrative.

“What did you do to try to invest in the Bay Area?” he asked. “Were you active civically? Did you try to use your money philanthropically to alleviate the problems? I kind of doubt it.”

Twilio is a cloud communications platform that adds messaging, calls and video to web and mobile apps. It employs about 3,600 people — 30% of whom are based in the South of Market or Mountain View. Lawson has lived in the city for 11 years, and he and his wife are raising their two kids here. Forbes estimates he’s worth $2.9 billion.

So you kind of want to hate him, but he seems far more aligned with the Marc Benioff-style thoughtful, generous billionaire than the off-putting Elon Musk type.

Musk has said he has moved to Texas, likening California to a championship sports team that’s grown complacent and has a “winning-for-too-long problem.”

Startup investor Keith Rabois said he’s moving because “San Francisco is just so massively improperly run that it’s impossible to stay here.”

Orion Hindawi, a Bay Area native and CEO of the cybersecurity company Tanium, moved his company to the Seattle area and said, “San Francisco is not the city it was 20 years ago … Blind support for a place that makes you unhappy? That doesn’t actually seem like a great decision to me.”

Joe Lonsdale, a venture capitalist who co-founded the software company Palantir, moved to Austin and wrote in a Wall Street Journal opinion piece that San Francisco is a place where feces cover the streets and “derelicts” chase people’s wives. He also griped that California’s cities are “ugly and unpleasant.” (San Francisco has many problems. Ugliness is certainly not one of them. Have you looked around?)

These guys are about as nuanced as President Trump in his assessment of liberal cities like ours. And while some of what they say is true, it’s not the whole picture. Besides, our problems are far more solvable if smart people work together to address them rather than skipping town for Texas and Florida.

Also, have you noticed people tend to think San Francisco was idyllic the day of their arrival and has never been as good since? Even if they didn’t support their local businesses, donate to local causes, subscribe to their local newspapers, join their neighborhood associations, vote, volunteer, write to their representatives or do anything else to keep it great?

If you want to move, just move. No need for the double-fingers on the way out.

Lawson, on the other hand, thinks San Francisco’s best days could be ahead and that the pandemic has provided the chance for a much-needed reset. With so many people moving out of the city, rents have dropped significantly. That gives us a little time to build more housing so we’re not as flat-footed when the next inevitable boom arrives.

“I hope we don’t waste this opportunity to put ourselves on a better track,” he said. “Ultimately, creating more supply of housing is a way to alleviate a lot of the challenges that San Francisco has.”

He’s hopeful — and so am I — that San Francisco will emerge a city with all the great characteristics we loved before: the fabulous restaurants and bars, packed Giants and Warriors games, fun concerts and cultural events, a spirit of creativity and innovation. But with space for a more diverse group of people who couldn’t afford to live here pre-pandemic.

He’s also hopeful that as vaccinations pick up and the virus subsides, City Hall can get out of “minute-to-minute catastrophe mode” and tackle all the problems they didn’t have time to address in 2020. And to think farther than next week.

“What is the five-, the 10-, the 20-year plan for the city of San Francisco?” he said.

Credit to him for sticking around to find out.

“This is home,” he said. “This is where our friends are. This is where our community is. This is where my company is. When you make a home somewhere, you want to make it better.”

He’s committing to make it better. So am I. Are you?

San Francisco Chronicle columnist Heather Knight appears Sundays and Tuesdays. Email: [email protected] Twitter: @hknightsf Instagram: @heatherknightsf

Correction: An earlier version of this column contained incorrect information on Tesla CEO Elon Musk. He said he has moved to Texas.