Only six electrolytes — minerals needed by the blood in fairly large amounts — are obtained from the diet.
The first two are provided by table salt: sodium chloride. Adding about 1/2 teaspoon of salt to your diet per day provides enough sodium and chloride. The typical American diet already has plenty of salt in junk food, fast food, etc., so no additional salt is needed. But if you are eating from a survival garden and from stored food, you might need to add salt to your meals. Be sure to include plenty of table salt with your stored foods.
Magnesium is found in whole grains and brans. Although whole grains spoil sooner in storage, it might be a good idea to have some whole grain flour, brown rice, and whole-wheat pasta in storage. You can also grow amaranth, quinoa, and buckwheat — three crops high in magnesium.
Potassium is highest in potato. Tomato juice and sun-dried tomatoes are also high in potassium. Fruits and vegetables generally contain some potassium. Canned tomato sauce, paste, and juice are a good source of potassium. Potatoes can be easily grown in a survival garden. Some varieties of potato can be grown from seed, rather than from small chunks of potato.
Calcium and phosphorus are both found in cheese and other dairy products. Long term storage of cheese is a little tricky. You can store those boxed mac and cheese dinners — the kind with the powdered cheese or the “deluxe” kind with a paste-like cheese sauce. Your other good option is to throw a blocks of cheese in the freezer. Frozen foods keep indefinitely, but the consistency of the cheese may suffer.
If you are trying to survive from stored foods, you will need the three macronutrients: protein, fat, and carbohydrates, as well as the above six electrolytes. A survival garden is a good option for supplementing stored food. And if any food is still available at markets after the SHTF, you should prioritize macronutrients and electrolytes.