The Gemara in Masechet Nida (p.17) states that one may not eat a peeled egg, onion or garlic clove that was left overnight, because of a "Ruach Ra’ah," (evil spirit) that settles on it. This applies even if it was left in a refrigerator or other sealed container. Therefore, if one peeled an onion and put the leftover piece in the refrigerator overnight, it may not be used the next day. However, if a piece of the outer stalk remains, it is permitted. It would also be permitted if salt was added, or it was left overnight soaking in oil.
The Poskim discuss whether the restriction applies to a salad containing raw onion left overnight. In general, when the egg or onion is mixed with other ingredients, such as oil or lemon, it is not a problem. That is why it mayonnaise is permitted, even though it contains peeled eggs, since it is mixed with other ingredients.
The Poskim also discuss whether the restriction applies to dried garlic or onion powder or powdered eggs. Even though they contain no added ingredients, they are permitted, because they have been dried and pulverized. This is the opinion of Rav Svi Pesah Frank in his Har Svi (YD 74 ), Hacham Ovadia in Yabia Omer (2:7), as well as Rav Moshe Feinstein in his Iggerot Moshe (YD 3:20).
One interesting application of this Halacha is a case in which someone prepared a scrambled egg early in the morning, before dawn, to eat later in the day. Technically, this is also considered left overnight, as the food passed from night into day. Hacham Ovadia Hedaya (1890-1969), in his work Yaskil Abdi (OC 44) rules that the only way to permit such a food is to prepare it with other ingredients, such as oil or butter, commonly used in frying.
It is prohibited to eat peeled onions, garlic and eggs left overnight. If part of the stalk remains, or they were combined with other ingredients or dried, it is permitted.