skills/tabs/SKILL.md
Use when you need to switch between different views.
npx skillsauth add thedaviddias/ux-patterns-for-developers tabsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Switch between different views
Tabs organize content into multiple panels that share the same space, allowing users to switch between views without leaving the page. Only one tab panel is visible at a time, while the tab list provides persistent indicators of all available sections. Tabs reduce information overload by letting users focus on one content section at a time while keeping the full set of options visible and reachable with a single click or keyboard press.
Use Tabs to organize related content into parallel sections at the same hierarchy level where users benefit from switching between views. Common scenarios include:
references/pattern.md, then choose the smallest viable variation.Do's ✅
role="tablist" on the tab container, role="tab" on each tab, and role="tabpanel" on each panelaria-selected="true" on the active tab and aria-selected="false" on inactive tabsaria-controls (on tab) and aria-labelledby (on panel)tabindex: active tab gets 0, inactive tabs get -1tabindex="0" to the active panel so users can Tab into the content
Don'ts ❌<a>) for tabs unless they navigate to a different URLKeep All Panels in DOM (Hidden)
<!-- Better than removing from DOM — preserves state -->
<div role="tabpanel" hidden>...</div>
The Problem:
Making each tab focusable with tabindex="0" forces keyboard users to Tab through every tab before reaching the content.
How to Fix It:
Use tabindex="-1" on inactive tabs and tabindex="0" only on the active tab. Navigate between tabs with Arrow Left/Right keys.
The Problem:
Using <div> or <button> without role="tab", role="tablist", or role="tabpanel" makes the tab interface invisible to screen readers.
How to Fix It:
Apply the full ARIA tab pattern: role="tablist" on the container, role="tab" on each trigger, role="tabpanel" on each content area, with aria-controls and aria-labelledby connections.
The Problem: Using tabs for page-level navigation causes full page reloads, breaking the instant-switch expectation of tab interfaces.
How to Fix It: Use a navigation menu for page-level navigation. Tabs should switch in-page content without a page load. If URL sync is needed, use hash fragments.
For full implementation detail, examples, and testing notes, see references/pattern.md.
Pattern page: https://uxpatterns.dev/patterns/navigation/tabs
tools
Use when implementing help users understand their current location.
tools
Use when implementing multi-step forms and processes.
content-media
Use when implementing video playback with controls.
development
Use when choosing, comparing, or implementing UX patterns across the UX Patterns for Developers corpus.