Favorites

ARIA switch Role

switch
ARIA Widget RoleThis ARIA role is supported by all modern browsers.
Updated 28th November 2026

The switch role marks an on/off toggle, like a light switch. It works like a checkbox but is announced as on or off rather than checked or not checked.

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee

Description

The switch role is a type of checkbox that represents on and off values rather than checked and unchecked. It suits settings that take effect immediately, such as "Dark mode" or "Wi-Fi". The state is given by the required aria-checked attribute, and screen readers announce it as "on" or "off".

It is usually added to a <button> or a checkbox input, so the element is focusable and responds to the keyboard. Keep the label the same whatever the state. The mixed value isn't allowed. Safari supports a native switch with <input type="checkbox" switch>; elsewhere that renders as a normal checkbox, which is a reasonable fallback.

Properties

Category
Widget
HTML equivalent
None
Accessible name from
contents, author
Required parent role
None
Required child roles
None

ARIA Attributes

Required
aria-checked
Supported
aria-readonly, aria-required
Prohibited
None
Global
All global ARIA attributes can also be used, such as aria-label, aria-labelledby, aria-describedby, aria-hidden.

Syntax

<element role="switch">

Example

<button type="button" role="switch" aria-checked="false"
onclick="this.setAttribute('aria-checked', this.getAttribute('aria-checked') !== 'true')">
Dark mode
</button>
<style>[role=switch]::after{content:" Off"}[role=switch][aria-checked=true]::after{content:" On";color:#16a34a}</style>

Browser Support

The following information will show you the current browser support for the switch ARIA role. Hover over a browser icon to see the version that first introduced support for this ARIA role.

This ARIA role is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee