What Is a Toggle?
A toggle is a control that helps people manage the state of something, typically using a different appearance for each state. It lets people choose between two opposing values that affect the state of content or a view, such as on and off. It’s important to note that toggles are only used for binary actions, not selecting from a list of options. If you need to support other types of selection, use a different control, like a checkbox or select box.
Labels and action text are essential for a toggle to make it clear what the binary choice will do. A good rule of thumb is to keep them short and concise, so they can be easily read at a glance. Often, toggle labels should be accompanied by an on/off icon to reinforce the binary nature of the action. This allows people to see which path they will be going down without having to open the toggle again.
Toggle switches are a great way to change the behavior of a feature with minimal impact to existing users. They can be particularly helpful when you want to experiment with new product features or user flows in a safe and controlled environment. A Champagne Brunch is a good example of this, as it allows you to test new functionality with a subset of your production users and learn what works and what doesn’t.
Toggles are also a great tool for implementing gradual rollouts or experimental launches. However, it’s important to remember that a feature flag that’s configured at runtime is still a binary decision that must be tested correctly. Depending on the approach used this can require re-deploying code into a testing environment and potentially delaying the feedback loop of the CI/CD process. For this reason, we recommend only using this method if you’re comfortable with it being re-deployed on a regular basis.