Beans are kind of like your best friend from high school — nearly forgotten but always ready to step back into the limelight and help out an old pal when needed.

As gorgeously demonstrated in Rancho Gordo’s new cookbook, “The Bean Book: 100 Recipes for Cooking with All Kinds of Beans” (Ten Speed, $35), beans are indeed magical, though not in the way you heard as a kid.

Beans and other legumes can be the ingredient you build an entire vegetarian or veggie-forward meal around. Or, they can help an economical cook stretch a dish twice as far with nutritious calories.

A healthful and shelf-stable plant food — they last for years when dried — beans have been among a home cook’s most reliable pantry items for a very long time. That’s why, for some, they’re often something of an afterthought, especially if the only time you ate them as a kid was when your mom tossed kidney beans into a pot of beef chili or made baked beans for a family cookout.

Vegetarians have always appreciated their versatility and nutritional punch, and because they’re cheap, they also were quite popular during the Great Depression and World War II as C rations. Sales also peaked during the coronavirus pandemic, when shoppers stockpiled long-lasting pantry essentials.

It wasn’t until Rancho Gordo, a California-based bean company, trotted out its branded packages of colorful heirloom beans that the plant began to take on cult status among some shoppers.

Unlike the bean varieties commonly found in even the smallest grocery stores, heirloom beans are mostly forgotten varieties that were developed on a small scale for certain characteristics, with seeds from the best crops passed down through the generations.

The result is beans that are fresher and more colorful than mass-produced beans, and they come in different shapes and sizes. They also have a more complex and intense flavor, fans say.

“The very good news is that you have to work extra hard to mess up a pot of beans, and it’s not difficult to make an excellent pot,” Steve Sando writes in the book’s foreword. “The even better news is that you become a better cook with each pot you make.”

Not convinced? Here are five reasons to jump on the bean bandwagon.

They’re easy to find

Even the smallest grocery store will have a selection of dried and canned beans. Common varieties include black, cannellini (white kidney), Great Northern, pinto, navy, kidney, Lima and garbanzo (chickpea) beans.

They’re affordable

Beans are a bargain at the supermarket. Many varieties cost less than $1 a can, and dried beans are an economical way to build a menu.

Rancho Gordo’s heirloom beans cost substantially more. (They run $6.25-$7.50 for a one-pound bag, with free shipping on orders over $50.) But they are sold within a year of harvest, which makes them more flavorful and tender. A bag also comes with cooking instructions and recipe suggestions, and the quality is outstanding.

Plus, after cooking their beans with aromatics, “you are left with essentially free soup,” Sando writes in the cookbook. “If you drain properly cooked and seasoned beans, the liquid you are left with is delicious.”

They’re nutritious

Beans are a great source of plant-based protein and both soluble and insoluble fiber, and they include essential minerals like iron, magnesium and potassium. If you’re watching your weight or following a particular diet, beans are naturally free of fat, sodium and cholesterol and are rich in complex carbohydrates. They also contain antioxidants and folate. And if you’re vegan or vegetarian, most types of dry beans are rich sources of iron.

They’re a cinch to cook

Dry beans have to be soaked overnight, but cooking them is easy. They can be cooked on the stovetop, in a slow cooker, in the pressure cooker or in the oven. Canned beans are even easier — just rinse and drain, and they’re ready to go.

They’re versatile

Beans can be made into soup, salad or dips, top nachos, add some heft to a casserole or be mashed into the makings of a veggie burger. You also can add them to brownies and other baked goods, toss them with pasta, add them to chili or a rice bowl, or stuff them into a taco or burrito.