A toggle is a switch that has two positions, on or off. It’s the preferred way to change settings in software and hardware, and is often found on options menus in all kinds of applications. The word can also describe a switch that alternates between two different things, such as switching between screens as you video chat with two friends at once.
When used for changing user settings, toggles are usually better than radio buttons because they provide a clearer indication of what the toggle does (and what state it’s currently in). The best toggles have simple and direct labels that clearly communicate what will happen when the switch is flipped to its new position. They should be positioned in a way that is easily accessible, such as at the top of the screen or next to the “x”. It’s important to note that colors can be ambiguous and should be carefully chosen. Consider societal and cultural factors when choosing a color to indicate state.
The most common use of toggles is to perform experiments with different product features for a limited number of users. This is often called Canary Release or Champagne Brunch Testing. Since the toggle configuration will be changing on a per-release basis it is less critical to test every possible combination of states. However, when the feature is rolled out to all users a careful review of the toggle configuration is typically required. To make this review easier many teams choose to move the toggle configuration into some kind of centralized store, usually an existing application DB, and then build out a UI which allows developers, testers and product managers to view and modify the flags.