A toggle is a switch that can be turned on and off to change its state. It is often used in technology, computing, programming, and communications to provide users with a way to switch between different settings or options.
A common use case for a toggle is allowing users to control the visibility of content within an article. This allows editors to hide areas of content at a moment’s notice without changing the article itself. The Visibility Toggle is found in the world configuration menu (a gear icon with double gears in the top right corner) and can be activated by clicking it. Once active, the toggle button will be shown with a checkmark on it. Unchecking it will disable the toggle and hidden content will no longer be visible to readers.
While it is tempting to add large swaths of code to be controlled by a series of toggles, many teams find that it’s easier to maintain and debug if toggles only control a small scope. It’s also better to limit the number of toggles that are enabled in a release, as enabling more than one could confuse your users and lead to unexpected behavior.
Toggle can be a great way to test new features before releasing them to your entire user base. For example, an e-commerce company might use a toggle to split their configurator into two cohorts and compare the performance of algorithm B against algorithm A. If the team feels like they have conclusive data, they can remove the experiment toggle and algorithm B will go live for everyone.