A toggle is a button or switch that can be moved from one state to another. Toggles can be found in both hardware (such as the Caps Lock and Num Lock buttons on keyboards) and software.
When used correctly, toggles help users update preferences, settings, and other types of information. Toggle switches should provide direct labels, be consistent with standard visual design, and deliver immediate results. If a toggle does not fit these criteria, it may be better to use a checkbox instead.
Some teams use static files to manage their toggle configuration, but this approach is difficult once you reach a certain scale. To resolve this, savvy teams move their toggle configuration into some form of centralized storage, such as an existing application DB or a feature flag service.
Toggles can be a great choice for changing system settings or preferences, such as enabling or disabling Airplane Mode. However, they are not suitable for making binary choices or for changing a feature’s default state. In these cases, it is better to use a radio button or checkbox.
Savvy teams view their inventory of Feature Toggles as a cost and seek to keep it low by being proactive about removing toggles that are no longer needed. This includes adding a task to the team backlog whenever a toggle is first introduced and using an external service with expiration dates for unused toggles. In some cases, teams go as far as creating “time bombs” that fail a test (or even stop an app!) if the toggle is not removed in a certain time frame.