What Is a Toggle?

A toggle is a switch that has two states, on and off. Often the state is indicated by a color and there are cultural considerations when choosing the colors.

A feature toggle is used to temporarily hide sections or items in a presentation view, such as the map or article preview. It is also used for A/B testing and to control how content is displayed to different users.

Toggles are useful for engineering teams that want to test new features in the real world with live data. They allow your team to roll out a new version of your application with the experimental feature turned on for a select group of users while keeping the production version unchanged for everyone else. You can then remotely rollback the new feature without disrupting your entire user base.

For A/B tests it is important to make sure that you have good controls around how the toggles are set up. For example, you should make it clear to your users that the test is in progress. You should also clearly indicate when the toggle is activated or deactivated. Toggle switches are useful for this purpose because they can be applied and reset instantly.

Toggle configuration can be stored in static files or in an existing application DB. At a certain scale, the latter is preferred as it provides more flexibility when managing and modifying the configuration across multiple servers. Many teams will also build out some form of admin UI which allows product managers, testers and system operators to manage toggles and their configuration.