What is a Toggle?

May 4, 2024 by No Comments

Toggle is a term used in everyday technology and computing to describe the ability to switch between different settings. It can be found in hardware (like the Caps Lock or Num Lock key) and software applications (everything from settings menus to permissions controls). In programming, toggles are often referred to as feature flags, though we recommend using the term toggle whenever possible.

Visibility toggles allow the owner of a world to hide certain sections and items from viewers. To use the toggles, hover your mouse over a section or item that can be hidden. An eye icon will appear, click it to toggle the visibility of that item or section. Toggle the eye icon again to enable the item or section. Visibility toggles can be used to hide articles, containers, images, maps, key/value items, prompt linked articles, quotes, aloud boxes, and diplomacy relations. It is important to note that the visibility toggle feature does not work well with dynamic content that loads later in the page, such as spoilers and dynamic article vignettes.

In terms of accessibility, it is recommended that toggle switches be clearly labeled with an indication of whether the switch is on or off. This will help to avoid confusion for users and also reduce the number of database calls required to determine the toggle’s state. We recommend using visual cues such as movement and color to further differentiate the toggle’s state. Lastly, we encourage teams to limit the amount of code that is controlled by a single toggle. This will prevent large swaths of code from being toggled on and off, which could be confusing for the rest of the team and a nightmare to debug weeks or months down the line.