Bonds have two interesting aspects: quality and term. Quality ranges from U.S. government to "high yield" (junk) bonds from corporations who may not be able to pay. Term ranges from money-market funds (essentially) to 30-year or even 40-year bonds. When you pick a 30-year bond, and interest rates go against you, the bond value drops since nobody wants the lower interest rates.
So... since the crazy inflation of the early 1980s, bond yields have declined to their current historic lows. So when you look at prior bond performance - even 30 years worth - you're actually biasing your data with a time where bonds had gains from the way yields changed. And looking ahead, we can't fall to -5% bond yields, so that isn't going to repeat.
I favor bonds with shorter term. Within retirement accounts, consider iShares Core 1-5 year bond ETF (ISTB). Compare that to Vanguard Total Bond (BND):
ISTB has SEC yield 2.82% with duration 2.76 years
BND has SEC yield 3.01% with duration 6.15 years
If bond yields go up 0.25%, what happens?
2.76 duration x -1 x .25 = -0.69% performance hit to ISTB
6.15 duration x -1 x .25 = -1.54% performance hit to BND
So after 0.25% yield increase (maybe after a Fed interest rate hike):
BND: 3.01% - 1.54% = 1.47% total return (capital loss + interest)
ISTB: 2.82% - 0.69% = 2.13% total return (capital loss + interest)
If you think any interest rate hikes will happen, and will translate to higher bond yields, then a shorter duration protects against that scenario. Plus, it means your risk is being taken with stocks instead of bonds. As an added benefit, shorter-term (high quality) bonds tend to be the least correlated with stock moves.