When to Use a Toggle

A toggle is a switch that can be either on or off. It’s used in hardware, for instance in the caps lock or num lock keys on a keyboard. It’s also used in software, such as in options menus that appear in most applications. When a user clicks on a toggle, the feature is activated. When the user clicks again, the toggle is turned off.

A savvy team will avoid using toggles in areas that are subject to a lot of human attention. In these areas, toggles should be reserved for automation and for configuration settings that are unlikely to change frequently. For example, a toggle might be used to turn on a feature for a short period of time (such as during a product demo) or to enable an option that is only relevant for some users (such as whether to display user names in chat rooms).

Toggles are great when they can be used to introduce new functionality gradually and to control how quickly existing features are removed. For this reason they’re often used for things like A/B testing, enabling/disabling ecommerce features or changing Call To Action wording.

Another great use for toggles is for things that need to be rolled out in short order, such as a product release or a Champagne Brunch feature. Because of this, the toggling decision for a Release Toggle will generally be short-lived — usually no longer than a week or two. And because it’s a temporary feature, changing the toggling decision by rolling out a new release version is generally perfectly acceptable.

If you’re going to use toggles it’s important to remember that they should never require a user to click Save or Confirm for changes to take effect. This can confuse users and lead to frustration, so it’s best to use a checkbox instead when the goal is to show or hide content. When toggles are used, it’s important to make the labels clear so that users can easily understand what the current state of the toggle is.

Toggle configuration is typically stored in some kind of centralized location, often an application DB. As the volume of toggles grows it becomes important to ensure that this centralized system can easily be modified without having to re-deploy artifacts. This is why it’s common for teams to build out a kind of admin UI that allows system operators, testers and product managers to view and modify feature flags.