Floating shelves rely on a single rail or channel for support along the back edge. They work fine for a moderate amount of weight. The problem is, you might get accustomed to the shelf and pile things on it until it sags. If this is the case, the rail has become compromised and lost its grip. Even if you take if off and bend it back into shape, it won't be solid without some type of reinforcement. Repair that sagging shelf with decorative wood corbels to support the shelf from the bottom up.
Measure the length and depth of the shelf with a tape measure. Purchase one wooden corbel support for every 24 inches of shelf length. The length along the top of the corbel support should be equal to or no more than 3/4 of an inch shorter than the depth of the shelf. The vertical length of the corbel should be equal to the length at the top. Corbel supports are triangular with a curved front and a 3/4-inch−thick wooden plate on the back -- typically 2 inches wide -- that you will drill screws into to mount the corbel to the wall. If you've purchased a corbel kit with a detachable plate or keyholes on the back, it will have instructions for installation that don't require drilling holes. Corbel plates may also vary in size, depending on the size of the corbel.
Remove all the material from the shelf. Run a stud finder along the wall under the sagging shelf. Locate and mark each stud that passes behind the shelf.
Measure the dimensions of the bottom half of the floating shelf rail that will be below the corbel. The back corner of the corbel must fit tightly against the wall, so use a jigsaw to cut a notch in the back corner of the corbel so you can get that tight fit. Floating rails may differ, depending on type or manufacturer. If you're using a rail that doesn't extend below the shelf (therefore affecting the corbel), skip this step.
Use a drill/driver with a 3/16-inch bit to drill two holes on each side of the plate, if you're using the type with a plate. Drill the holes evenly spaced vertically through the plate on each side, tipping the bit 15 degrees so that the holes emerge out of the back of the plate near the center.
Apply construction adhesive to the top edge of each corbel support. Center the first corbel support on the stud nearest the center of the shelf. The plate should fit flat against the wall, and the bottom of the rail should fit into the notch at the top of the corbel, if applicable. The top of the corbel should fit tightly to the bottom of the shelf.
Insert 2 1/2-inch wood screws into the holes that you drilled, if applicable. Drive them in tight with a drill/driver to secure the corbel support to the wall. Place the other corbel supports on adjacent studs, skipping every other one as needed to support the shelf.