The selective capture of Cs(+) from solution is relevant to the remediation of nuclear waste and remains a significant challenge. Here we describe a new framework composed of [(CH₃)₂NH₂](+) and [Ga₂Sb₂S₇]²⁻ layers, which are perforated with holes. Shape selectivity couples with framework flexibility, allowing the compound to respond to the ion-exchange process. The size, shape and flexibility of the holes allow Cs(+) ions in an aqueous solution to selectively pass through and enter the material via an ion-exchange process. Following capture, the structure dynamically closes its holes in a manner reminiscent of a Venus flytrap, which prevents the Cs(+) ions from leaching out. This process has useful implications in the separation science of Cs as it relates to the clean-up of nuclear waste. The dynamic response we describe here provides important insights for designing new materials for the selective removal of difficult-to-capture ions.