You can buy floating shelves ... long enough on store shelves is also a challenge. You can special-order it at some home ...
Ideally, you should attach floating shelves ... however, the shelves will need extra support. Wall anchors, also called molly plugs, will help you build a sturdy foundation for your shelf.