We're about 5 years out from retirement...give or take a year or two in either direction, and we hold bonds in our portfolio. We did just move to a short-term vanguard bond fund instead of a total bond market index, as you don't really want to be in longer term bonds. We built our emergency fund up to two years of expenses during the pandemic, but with 5-ish years to go and with inflation likely to be a bit higher than we're used to for a period of time.... we moved all but 25K into our portfolio...currently 80/20....stock index fund to bond index fund. Holding as little cash as possible in this environment makes sense. This is still an aggressive portfolio by most definitions for early 50 year olds by most measures.
I've been reading a lot about how you don't want to be in bonds in an inflationary environment, but inflation isn't necessarily good for the overall stock market either. Look back at equity returns in the mid 70s to early 80s. There's also the usual "stock picker" talk of moving out of growth and into value...yada yada. I own a little bit of every company in the US stock market in VTSAX. And since a large majority of the companies in VTSAX are global entities...I'm invested in international stocks as well. I'm not smart enough to know which sectors may do well...and not do well....especially in a world where things move so quickly. All anyone can talk about lately is how expensive lumber is....well, if you've been paying attention, that phenomenon is changing quite quickly. Prices are tumbling...and suppliers and builders who have been hoarding stockpiles...are quickly beginning to unload their stash. If I was in the market to build a new house or do a home improvement project that requires lumber...I'd wait just a bit.
Also keep in mind that this stock market is quite frothy, and so owning a percentage in bonds allows one to preserve funds that will be moved into equities when portfolio rebalancing takes place. It evens out the wild ride that equities can provide. If you had 100% of your retirement funds in an S&P 500 fund and retired in 2000....you were in for a rough ride for the next decade. You began withdrawing from a portfolio that saw a 40% drop during the dot.com bust...or your first two years in retirement, the market recovered (but not to the heights of 2000)....and then came the 55% drop during the housing bust/Great Recession. Holding bonds during that time eased the pain you would have felt, and you could have pulled from the bond portion of that portfolio allowing equities time to recover.