If you are looking wanting it structurally attached to the wall, you’ll need to screw the large angle brackets into the studs.
The top needs to be at least 18” deep or people will scuff up the wall with their feet. I would go 20”, personally.
The cheapest top you can do that will last, is a piece of CDX exterior grade plywood. You can paint it, stencil it, stain it and clear coat it with polyurethane.
I would tack casing along the edge to make it look thicker.
Use pallets cut one in half then attach with hinges make shure to use 5 inch screws and go into studs
Do you mean you want to do a floating bar table? Check out this post. It's a kids' desk, but you could do the same thing and mount it higher on the wall. https://www.facebook.com/Jessica-Welling-Interiors-358750794624610/