Allow at least 3 days! Add more days if you want to really see everything! It also depends on how active a hiker you are. There are great day trips with varying degrees of difficulty in and around the park.
WHAT ARE “MUST SEE” SIGHTS AND THINGS TO DO?
In the valley, ride the Shuttlebus, walk the valley paths, raft/inner tube down the river, tour in an open air tram, hike to Mirror Lake, picnic at Sentinel Beach, hike to the top of a waterfall or to the top of Half Dome, climb El Capitan. Visit the Village. See the Visitor Center and the Ansel Adams Gallery, shop at Curry Village. Check out the Ahwahnee Hotel. Other areas within the park or just outside: Tuolumne Meadows, Mariposa Grove, Giant Sequoia Redwood Trees, Wawona Point (and historic hotel), skiing at Yosemite’s Badger Pass in winter), Bass Lake, Oakhurst, and many others. Allow 1-3 days or more for each area depending on how active a hiker/camper/skier/snowboarder you are.
To experience the backcountry as a backpacker/camper take 3-14 day trips. I’ve been to the Tiltill Valley above Hetch Hetchy Loop and down the South Fork Merced River in the Sierra National Forest, both were excellent backpacking trips! Learn the necessary skills, rules & regulations before entering the wilderness.
You are also close to Lee Vining, Mammoth Mountain and Mono Lake State Preserve which are near the east entrance to the park. More info at the John Muir Trail and the Yosemite Park websites.