The toggle switch mimics a physical switch that allows users to turn things on or off. The control has two states: on (checked is true) and off (checked is false).
Use a toggle switch for binary operations that become effective immediately after the user changes it. For example, use a toggle switch to turn services or hardware components on or off. A good way to test whether you should use a toggle switch is to think about whether you would use a physical switch to perform the action in your context. After the user toggles the switch on or off, you perform the corresponding action immediately.