Sagrada Familia enforces a strict dress code that prohibits tank tops, strapless shirts, exposed backs or bellies, short shorts, barefoot attire, flip-flops, and sandals. Visitors are also not allowed to enter while wearing special clothing for celebrations or festivities.
You are allowed to stay at Sagrada Familia until closing time. Check the official website for the daily opening hours before your tour.