What Is a Togle?

A toggle is a switch that has two positions, on and off. It’s used when you want to enable a feature and then disable it or, more commonly in software development, when you have an options menu or other similar set of choices that the user can select from. In general, toggles should be accompanied by clear and consistent labeling to prevent confusion and to help users evaluate the impact of switching between the on and off positions. They should also be designed to look and behave as sliders to further reinforce the idea that they are switches that change their position when switched. Additionally, designers should carefully consider color and the societal and cultural implications of using specific colors as a signal for toggle state.

When a toggle is a part of the configuration of a release it can usually be changed easily by rolling out a new version with that particular toggle configured differently. However, when a toggle is more long-lived or a product-centric feature like a Champagne Brunch feature (exposed to only some users) it may be easier to use some form of distributed configuration system where the toggle configuration is stored alongside the code in source control.

Managing this sort of configuration at scale can be challenging, especially when you have a large fleet of servers and/or a need to support a number of different environments. To avoid these challenges many teams choose to move their toggle configuration into some type of centralized store, often an existing application DB. In addition to this it’s often helpful to build-out an admin UI that allows operators, testers and product managers to view and modify the toggle configuration.

Testing a toggle is typically done by running a test with both the expected production toggle configuration and the fallback toggle configuration. It’s also wise to run tests with the toggle flipped Off to make sure that existing or legacy behavior doesn’t break if the toggle is flipped On and to also verify that any future or planned behavior is enabled by the toggle being flipped On.