I think with 3-5 days in Shanghai you can see its most essential highlights:
Personally, I think 3 days is doable. It would be rushed, but doable.
For something more in-depth and at a slower pace, I'd recommend at least 5 days.
This is only for the city of Shanghai. If you want to check out surrounding areas (like the water town of Wuzhen), you'll need more time
There are 3 main areas you'd want to check out:
The Bund and old downtown area (1-2 days): this is the historical center of business and life in Shanghai. It used be an international concession during the city's colonial times, meaning a consortium of countries had jurisdiction over this area. The Bund is the highlight here, with a collection of art-deco buildings on the waterfront.
French Concession area (1-2 days): it's mostly residential but with also with lots of small cafes, boutiques, and galleries. As its name suggest, this area used to be under France's jurisdiction, a heritage still visible from its architecture
Pudong/Lujiazui area (1 day): this is the Shanghai you see on postcards. It's got lots of super tall skyscrapers here, with upscale malls, bars, and restaurants. I found that life here happens mostly indoors in the various shopping malls, and there's not that much to see or do here beyond snapping a few pictures