ARIA Widget Roles

ARIA role: tablist

A container for controls selecting tab panels. Contains tabs, has a name when needed, manages one tab stop and arrow navigation; aria-orientation describes vertical layout when used. Explicit roles do not implement visual presentation, interaction or focus management; verify allowed role/element combinations in ARIA in HTML. Accessibility exposure varies with browser, platform and assistive technology. Test relevant combinations; rendering is not proof of accessibility.

Formal Syntax & Structure

html syntaxhtml
role="tablist"

Parameters & Attributes

NameTypeDescription
roletokenExplicit role token tablist; use only where allowed. Omit when native semantics match.
aria-orientationtokenRelevant when applicable. Describes the orientation of a widget or separator. It does not change layout or arrow-key handling. Set it to match real visual and interaction orientation, considering role-specific defaults. Values: horizontal, vertical, undefined.

Working Example

Example Snippethtml
<div role="tablist" aria-label="Account settings">  <button id="tab-profile" role="tab" aria-controls="profile" aria-selected="true" tabindex="0">Profile</button>  <button id="tab-security" role="tab" aria-controls="security" aria-selected="false" tabindex="-1">Security</button></div><section role="tabpanel" id="profile" aria-labelledby="tab-profile" tabindex="0">Profile settings</section><section role="tabpanel" id="security" aria-labelledby="tab-security" tabindex="0" hidden>Security settings</section><style>  [role=tab][aria-selected=true]{border-bottom:3px solid currentColor;font-weight:bold} [role=tab]:focus-visible{outline:2px solid currentColor;outline-offset:2px}</style><script>  const tabs = Array.from(document.querySelectorAll('[role="tab"]'));  function activate(index) {    tabs.forEach((tab, i) => {      const active = index === i;      tab.setAttribute('aria-selected', String(active));      tab.tabIndex = active ? 0 : -1;      document.getElementById(tab.getAttribute('aria-controls')).hidden = !active;    });    tabs[index].focus();  }  tabs.forEach((tab, i) => {    tab.addEventListener('click', () => activate(i));    tab.addEventListener('keydown', e => {      let next;      if (e.key === 'ArrowRight') next = (i + 1) % tabs.length;      else if (e.key === 'ArrowLeft') next = (i + tabs.length - 1) % tabs.length;      else if (e.key === 'Home') next = 0;      else if (e.key === 'End') next = tabs.length - 1;      else return;      e.preventDefault(); activate(next);    });  });</script>
HTML Reference