Toggle is a control that allows users to quickly and easily switch between two possible states. It’s commonly used for “on/off” switches but can be applied to any binary action that requires a fast user response. It is important to use toggles sparingly and only when they make sense in a given context, as using them in the wrong places can lead to confusion for users. When they are used they should be easy to understand, clearly communicate what the action will do and provide immediate results. They should also be a small and unobtrusive control, which is why they are often used in conjunction with other controls like radio buttons or checkboxes.
Toggles can be configured in a number of ways ranging from static files that are hardcoded into code (similar to the commenting approach discussed in the Toggle Configuration article) through to fully dynamic systems that allow us to set and reset specific service instances via a Toggle Router. The most common approach to managing Feature Flags via Toggle is through a set of centralized files which are deployed to servers, enabling system operators, testers and product managers to manage them consistently across the entire application.
When managing Toggle Configuration in this way it’s important to remember that while static files are fine for some Feature Flags, particularly Permissioning Toggles, they may be too long lived for others. This is where the ability to set a Toggle’s configuration via a service, rather than through hardcoding in static code, becomes very useful.