Toggle Buttons / Switch

Screenshot of audio control toggle buttons
Figure 1 Example of Play/Pause and Mute/Unmute toggle button

A toggle button is a component that has two possible states – on and off. The state is defined using aria-pressed attribute.

NOTE:

  • New to accessibility or uncertain of requirements, it will be helpful to review all sections below.
  • Already familiar with requirements, skip to the “Working Example” section for sample HTML, CSS and JavaScript (when needed), along with a working demo.