A toggle is a switch that can be moved between two positions. It’s most commonly used to turn on and…