Latest Post

What is a Togle? What is a Slot?

Toggle is a control that allows people to select one of two opposing values that affect the state of content or a view. It is a powerful tool when used correctly. However, if you are trying to support actions that require a list of choices use a different element such as a button instead.

Toggles are heavily used and can be easy to understand if they are used in the right context. However, if they aren’t used in the right context they can be confusing and may lead to errors. It is important to clearly identify the setting, view, or content that a toggle switch controls as well as the current state. Generally, toggle switches look like sliders and utilize visual cues (movement and color) to help prevent confusion.

A great way to avoid visual confusion is to ensure that your toggles are accessible to screen readers and assistive technologies. Unfortunately, most web developers and designers don’t know enough about accessibility and just copy some toggle code they found online. This often leads to toggles that are completely inaccessible for users with disabilities.

Another way to help avoid confusion is to test the toggle configuration that you expect to go live in production as well as a fallback configuration with all toggles flipped On. This approach can help you catch regressions in your CI/CD pipeline before they reach production. However, it can have a detrimental impact on the cycle time of your validation process since you will need to restart your tests every time you flip a toggle.