The Stephen King story about people trapped in a supermarket is The Mist.
The Mist is a science-fiction horror novella set in Bridgton, Maine. After a violent thunderstorm and power failure, an unnatural mist surrounds the town and conceals deadly creatures. Commercial artist David Drayton takes refuge in a supermarket with his young son Billy and other survivors.
The supermarket becomes both a shelter and a pressure cooker. The people inside must contend with giant insects, pterosaur-like creatures, and spider-like predators, but the story's human danger is equally important. Fear, uncertainty, and religious fanaticism fracture the group, particularly as Mrs. Carmody persuades some survivors that the disaster represents divine punishment.
King said the idea came from visiting a supermarket with his son after a severe storm. He imagined prehistoric creatures attacking the building, and that image became the story's central premise. The novella first appeared in the 1980 anthology Dark Forces and was later collected in Skeleton Crew. Frank Darabont directed a 2007 film adaptation.