Light-responsive materials with high adsorption capacity and sunlight-triggered regenerability are highly desired for their low-cost and environmentally friendly industrial separation processes. Here we report a poly(spiropyran acrylate) (PSP) functionalized metal–organic framework (MOF) as a sunlight-regenerable ion adsorbent for sustainable water desalination. Under dark conditions, the zwitterionic isomer quickly adsorbs multiple cations and anions from water within 30 minutes, with high ion adsorption loadings of up to 2.88 mmol g−1 of NaCl. With sunlight illumination, the neutral isomer rapidly releases these adsorbed salts within 4 minutes. Single-column desalination experiments demonstrated that PSP–MOF works efficiently for water desalination. A freshwater yield of 139.5 l kg−1 d−1 and a low energy consumption of 0.11 Wh l−1 would be reached for desalinating 2,233 ppm synthetic brackish water. Importantly, this adsorbent shows excellent stability and cycling performance. This work opens up a new direction for designing stimuli-responsive materials for energy-efficient and sustainable desalination and water purification.