Use when implementing expand and collapse content sections.
中文简介正在准备中。当前显示原文说明。
Use when you need to switch between different views.
中文简介正在准备中。当前显示原文说明。
查看安装方法安装前可以查看交给 AI 代理的指令内容。
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
还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Use when implementing expand and collapse content sections.
中文简介正在准备中。当前显示原文说明。
Use when implementing user account configuration and preferences.
中文简介正在准备中。当前显示原文说明。
Use when implementing social activity and updates stream.
中文简介正在准备中。当前显示原文说明。
Use when implementing conversational AI chat interfaces.
中文简介正在准备中。当前显示原文说明。
Use when implementing handling AI-specific errors.
中文简介正在准备中。当前显示原文说明。
Use when implementing loading states for AI operations.
中文简介正在准备中。当前显示原文说明。