From the Super Mario Wiki
Magnets, also known as Magnet Rods and Magnet Blocks, are magnetic surfaces that Mini Mario and other toys can walk on, appearing only in the Mario vs. Donkey Kong series. They were green with areas of silver in Mario vs. Donkey Kong 2: March of the Minis and Minis March Again!, but they were redesigned in Mini-Land Mayhem! to completely silver with studs. In March of the Minis and Minis March Again!, they appear in their versions of Magnet Mania (along with a special rod that flips over, flipping Mini Mario with it, appearing only in Magnet Mania+), while in Mini-Land Mayhem!, they appear in Cosmic Adventure, Rainbow Summit, and Secret Storage. In Tipping Stars, they are introduced in Orbiting Observatory, continuing to appear in subsequent Bonus levels.