Uncategorized

What Is a Toggle?

Toggle is a digital trade journal highlighting the vital role technology plays in companies and organizations across industries—and the men and women who make it possible. We feature articles on everything from the latest tech to best practices for cybersecurity, data privacy, and more.

A toggle is a boolean control with two states: on and off. A toggle can enable or disable existing or legacy behavior, or it can enable new functionality. Because toggles enforce a mutually exclusive state, they are easy to use. They also make it easier to implement accessibility features because they don’t rely on color alone to convey state (see WCAG’s guidance on this).

Traditionally, developers have created release toggles when they plan on pushing new code into production. They generate a feature flag in their master codebase that leaves their current branch inactive as they work on a new feature, which allows them to meet delivery goals without having to wait until their feature is complete to push a full changeset into production. Having these toggles in source control allows teams to easily review and roll back toggle configurations, making release management easier.

When implementing runtime configuration using toggles, it is important to test the exact toggle configuration that will be deployed. This means testing a feature with all toggles flipped On, as well as with all toggles flipped Off. This prevents a single toggle from introducing unexpected regressions into your live environment. In addition, it helps if your toggle system supports dynamic in-memory re-configurations of specific service instances, rather than forcing you to re-deploy an artifact into a test environment each time you want to change the state of a particular toggle.