Medical workers at a Kaiser Permanente French Campus test a patient for the novel coronavirus, COVID-19, at a drive-thru testing facility in San Francisco on March 12

Millions of San Francisco area residents on Monday were ordered to stay home to slow the spread of the deadly coronavirus as part of a lockdown effort covering a section of California including Silicon Valley.

Six counties in the region and the city of Berkeley joined the effort after data showed 258 confirmed cases of COVID-19 with four deaths in the jurisdictions with some seven million people.

A "remain-in-place" order announced by San Francisco Mayor London Breed will go into effect at the end of Tuesday here and remain in force until April 7, with the possibility it will be extended.

"We know these measures will significantly disrupt people's day to day lives, but they are absolutely necessary," Breed said.

"This is going to be a defining moment for our city and we all have a responsibility to do our part to protect our neighbors and slow the spread of this virus by staying at home unless it is absolutely essential to go outside."

The order directs all residents to remain in their homes unless they need to tend to "essential" activities.

Covered by the shutdown were the counties of Alameda, Contra Costa, Marin, San Francisco, San Mateo, and Santa Clara along with the city of Berkeley.

When people do go out, they are to remain at least six feet (two meters) away from anyone else.

Businesses not deemed essential are to suspend operations, and gatherings of any kind outside of those sharing homes will be prohibited, the order mandates.

The list of businesses considered essential included hospitals, banks, fueling stations, transit, police, fire, and grocery shops.

San Francisco residents were told they can go outside for walks as long as they keep their distance from anyone else who is out and about.

Homeless people were urged to seek shelter.

"Our response has been grounded in data, science, and facts," San Francisco director of health Grant Colfax said in a release.

"Based on what we can predict, now is the time to do everything we can to prevent the situation from getting much worse in a matter of days or weeks. Every hour counts."

The affected region includes the cities of Oakland, Palo Alto and San Jose and headquarters of tech firms include Apple, Google, Facebook and Netflix.