How can I implement this?

Magnets?