A toggle is a switch that has two positions, on or off. We use the word to describe switching between settings, programs or content views — for example, when using a video chat application with multiple friends at once you toggle back and forth between screens so you can see both people as you talk. Often the current state is indicated by visual styling – for example, a toggle switch that turns red when it is on and blue when off. This is important as we don’t want to rely solely on color to convey state (see WCAG 1.4.1).
Toggles are commonly used to implement responsive designs in web development. They can be used to hide navigation menus or sidebars based on screen size.
Typically a toggle is implemented via a static file which can be updated in source control to alter its configuration. As projects scale modifying these files can become cumbersome and ensuring consistency across deployments becomes more difficult. To solve these challenges many organizations move their toggle configuration into some type of centralized store, often an existing application DB. This is usually accompanied by some form of admin UI which allows system operators, testers and product managers to view and modify feature flags and their configuration.
Savvy teams realize that a codebase filled with unused toggles comes with a management overhead and seek to keep the inventory as low as possible. This may include adding a task to the team’s backlog or building it into their management platform to remove a toggle when its lifecycle has run out.