Skip to content

Nested Tabs inherits parent variant — inner Tabs cannot override to primary #6381

@J4v4Scr1pt

Description

@J4v4Scr1pt

HeroUI Version

3.0.1

Describe the bug

When nesting Tabs components (e.g., page-level secondary tabs with an inner primary tabs for filters), the inner Tabs inherits the parent's variant="secondary" styling and cannot override it, even with an explicit variant prop.

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

 <Tabs variant="secondary" selectedKey={activePage} onSelectionChange={setActivePage}>
    <Tabs.ListContainer>
      <Tabs.List aria-label="Pages">
        <Tabs.Tab id="page1">Page 1<Tabs.Indicator /></Tabs.Tab>
        <Tabs.Tab id="page2">Page 2<Tabs.Indicator /></Tabs.Tab>
      </Tabs.List>
    </Tabs.ListContainer>
    <Tabs.Panel id="page1">
      {/* This inner Tabs should be primary (pill style) but renders as secondary */}
      <Tabs variant="primary" selectedKey={filter} onSelectionChange={setFilter}>
        <Tabs.ListContainer>
          <Tabs.List aria-label="Filters">
            <Tabs.Tab id="all">All<Tabs.Indicator /></Tabs.Tab>
            <Tabs.Tab id="active">Active<Tabs.Indicator /></Tabs.Tab>
          </Tabs.List>
        </Tabs.ListContainer>
      </Tabs>
    </Tabs.Panel>
  </Tabs>

Expected behavior

Expected: Inner Tabs renders with primary (pill) variant.
Actual: Inner Tabs renders with secondary (underline) variant inherited from the parent.

This appears to be a context inheritance issue — the inner Tabs picks up the parent's variant through the shared react-aria TabsContext.

Screenshots or Videos

No response

Operating System Version

Windows 11

Browser

Chrome

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions