Skip to content


What component has

Keyboard support

Keyboard support
TabMoves focus to the next focusable element.
Shift + TabMoves focus to the previous focusable element.
Enter, SpaceActivates the button.

Roles & attributes

The list below describes roles and attributes that component already has.

Roles and attributes
buttondiv, aIdentifies the element as a button. Accessible name for the button is defined by the text content of the element or by adding aria-label.
tabIndex="0"div, aIncludes the element in the Tab sequence. Needed on the a element because it doesn't have a href attribute.
aria-pressed="false"aIdentifies the button as a toggle button. Indicates the toggle button isn’t pressed.
aria-pressed="true"aIdentifies the button as a toggle button. Indicates the toggle button is pressed.

Considerations for developers

  • A <button> tag doesn't need anything special to work. Use <button> when you can, but it is possible to use other elements as long as you add role="button" and add JavaScript to replicate the button functionality.
  • Ensure visual labels and programmatic labels match.
  • Just like links, you can add class="visuallyhidden" with descriptive text to give more context to the button's purpose.
  • Usually, SVG icons should be hidden from screen readers on a button that has a text label.
  • You can use <input type="image"> to make a graphical button. It takes a src and alt attribute just like traditional images.
  • Button states are important, not just button styling! If you are only toggling classes to visually manage state of your components, you are likely not appropriately conveying that state to users of assistive technologies.
  • If there is no text in the button, it is necessary to add aria-label with a button description.

Find live examples in the A11y style guide.

Roles and attributes

The list below will help you to keep in mind the necessary roles and attributes to make our components fully accessible in the particular cases in your interfaces.

aria-labeldivDefines a string value that labels an interactive element. It is a required for buttons without text content.
aria-labelledbydivThe aria-labelledby attribute identifies the element (or elements) that labels the element it is applied to. It is a required for buttons without text content.


Other recommendations

See more accessibility recommendations in the common Accessibility guide.

Released under the MIT License.

Released under the MIT License.