Using Toggle to Implement Feature Flags

Toggle is a simple user interface component that allows a user to update their preferences, settings and more. It is important that these toggles are designed with clear and direct labels, standard visual design and deliver immediate results. Additionally, it is critical that feature toggling only covers a small and clear scope within your application. If you are tempted to put large swaths of your application under the control of a series of toggles it can become confusing for your team and a nightmare to debug weeks or months down the road.

A toggle is a switch with two positions: On and Off. It’s used to enable or disable functionality and can be found in hardware and software alike. For example, the caps lock and num lock keys on your keyboard are toggles that can be switched on or off. Similarly, the options menus of most applications use toggles to provide users with control over specific features.

Using toggles to implement feature flags is a powerful tool in the hands of your engineering team. It can allow you to quickly and efficiently test new code with your entire user base and make data-driven decisions about what’s working and what isn’t.

Typically, these toggles live for only a few days or weeks and are then retired once they have proven to be stable. However, some toggles can be semi-permanent and used to test larger code changes. In these situations it is a good idea to store the toggle configuration in some type of centralized DB which can be easily modified by developers, testers and product managers for consistency.