Latest Post

What Is a Toggle? What Is a Slot?

Toggle is a user interface control that allows the user to update preferences, settings and other types of information. Toggles are a preferred alternative to checkboxes and radio buttons because they take up less screen real estate and offer the ability for a toggle to have both an ON and OFF state (as opposed to a single ON/OFF button).

As with all user interface elements it’s important to think carefully about how your team uses toggles. Ensure that your toggles are clearly labeled and use standard visual design practices. It’s also a good idea to only use toggle switches when they control information that can be updated on-the-fly, i.e. toggles shouldn’t be used to control long-term, permanent preferences or settings (as it can be confusing for users).

When designing visual cues for toggles try to avoid introducing confusion by using primary colors that are clearly distinct and easy to differentiate. A more pronounced, saturated color should denote the active toggle and a lighter shade the inactive toggle. Using embossment as the main visual cue for a toggle can cause confusion and didn’t perform well in our tests, whereas a border or more subtle accents performed much better.

Whenever possible it’s preferable to use a real feature flag system which allows toggle configuration to be re-configured dynamically at runtime. This can help to reduce regressions in production by making sure that the toggle’s expected behavior is always enabled and new or untested code is disabled. For systems that do not support real feature flags, it’s best to hardcode toggle configuration through comments or a preprocessor feature such as #ifdef. This approach is not ideal for testing because it requires restarting the process you’re testing to re-deploy the toggle configuration and can have a detrimental effect on your team’s validation cycle time.