ARIA Structure Roles
ARIA role: tabpanel
The content area associated with a tab. Use aria-labelledby referencing its tab; hide inactive panels and ensure active content can be reached by keyboard. 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="tabpanel"Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| role | token | Explicit role token tabpanel; use only where allowed. Omit when native semantics match. |
| aria-labelledby | ID reference list | Relevant when applicable. Computes an accessible name from referenced elements in the listed order. It takes precedence over aria-label in applicable name computation. Ensure IDs exist; prefer native label for form controls where possible. Values: space-separated IDs of name-providing elements. |
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>