Toggle is a control that quickly switches between two possible states. It is most commonly used for “on/off” switches. It’s useful for allowing users to update preferences, settings, and other kinds of information quickly. Toggles are a useful addition to a user interface because they can be implemented without the need for additional markup or complex scripts.
Toggles should be deployed sparingly and with great thought. They should be a tool for providing users with the information they need, not just an excuse to throw a bunch of stuff at them. If you find yourself using toggles to hide content on your site, it’s worth exploring alternative methods for hiding content such as a table of contents or sidebar menus.
In general, a toggle should answer a question that has a binary answer: “Are you logged in?” “Is your article private or public?”
This allows users to see the full context of their actions. This helps them make better decisions when navigating your site.
Ideally, toggles should be labelled clearly and should use action-oriented text. They should also have an icon associated with them to provide visual cues for the user. In order to be effective, toggles should be able to be used by users of all experience levels. Toggle switches should be placed within the user’s immediate reach and should deliver a result immediately upon clicking them.
If you’re using toggles to hide content, it’s important to note that even though they will display a checkmark next to the toggle and the corresponding text (“Show/Hide”), anyone who knows how to inspect the source code of your website will be able to see that the content is still present on your page. To avoid this, consider using subscriber group containers or hidden comments instead.
It’s also important to test the toggle configuration that you expect to release into production. This includes all of the toggles that you intend to be flipped on and all of the fallback configurations that will be enabled when those toggles are flipped off. This will help you prevent any unexpected regressions in a future release.
Creating toggles within your article content doesn’t require copying and pasting any HTML as the Toggle Item extension for Storybook lets you transform standard ordered (