For AI agents: the complete documentation index is available at https://rickyshin93.github.io/tao-ui/zh/llms.txt, the full documentation bundle is available at https://rickyshin93.github.io/tao-ui/zh/llms-full.txt, and this page is available as Markdown at https://rickyshin93.github.io/tao-ui/zh/components/tabs.md.
v0.0.57
  • 简体中文
  • Tabs

    导航@rockshin/tao-ui

    在同一上下文中切换多个同级内容面板。

    何时使用

    内容类别同级且用户只需查看其中一个面板时使用 Tabs。

    推荐

    • 标签短且互不重叠。
    • 默认激活最常用或最安全的面板。

    避免

    • 不要用 Tabs 隐藏必须按顺序完成的步骤。

    代码演示

    基础用法

    General settings.
    TSX

    卡片变体与尺寸

    General settings.
    General settings.
    General settings.
    TSX

    受控与禁用标签页

    General settings.
    TSX

    外部控制标签页

    通过 activeKey 与 onChange 把标签页状态纳入应用逻辑。

    Security settings content.

    activeKey: security

    TSX

    禁用标签页

    禁用暂不可访问的内容入口,其他标签仍可切换。

    This tab works.
    TSX

    卡片标签尺寸

    组合卡片变体与不同尺寸,对比密度与内容区域。

    small

    General settings content.

    medium

    General settings content.

    large

    General settings content.
    TSX

    全局尺寸与局部覆盖

    继承 Provider 的尺寸,并在需要时为某组标签显式覆盖。

    General settings content.
    TSX

    切换时销毁内容

    比较保留内容和销毁内容的行为;在面板中输入后切换可观察状态是否保留。

    Only this panel is in DOM when active.
    TSX

    API

    Tabs

    属性说明类型默认值
    className节点类名string | undefined-