First, make a rectangle with the rectangular marquee tool. Then, fill it in with what ever color you want. Change the opacity of the bar if you want.
Now goto add layer style/gradient overlay. Change angle to 0 degrees. Press ok. You've got a bar with gradient.