Rinse the beans in a colander under fresh water, and pick out any undesirables (stones, etc.)
Add the beans to the Instant Pot.
Add all the remaining ingredients: onion, oil, garlic cloves, bay leaves, salt, and water. If you want to add any other seasonings (spices) or chopped veggies (carrots, celery) now is the time to do this.
Lock the lid on and set the Instant Pot to Manual, High Pressure for 30 minutes (for black beans and pinto beans) or 40 minutes (for chickpeas). See cooking times in the notes below for other types. The valve on top should be set to Sealed.
Once the beans are done cooking, let the pressure release naturally for 30 minutes before releasing the remaining pressure (use a hot pad holder or towel) and opening the lid.
Remove the aromatics (bay leaves, onions, garlic). Drain and rinse the beans, if desired. Or, store or serve the beans with some of the liquid. If you're storing the beans in the fridge (or freezer), I recommend storing the beans in some of the liquid to keep them fresh.
