@@ -4,7 +4,7 @@ import { useButtonProps, useIsomorphicEffect, useMergeRefs } from "../../hooks";
4
4
import { Polymorphic , type PolymorphicProps } from "../../primitives" ;
5
5
import { useComposite } from "../../primitives/composite/composite-context" ;
6
6
import { ariaAttr , dataAttr , tx } from "../../utils" ;
7
- import { getTabId , useTabs } from "./tabs-context" ;
7
+ import { getPanelId , getTabId , useTabs } from "./tabs-context" ;
8
8
9
9
type TabsTabProps = {
10
10
/**
@@ -27,6 +27,7 @@ export const TabsTab = (props: PolymorphicProps<"button", TabsTabProps, "type" |
27
27
const { activeIndex, setActiveIndex } = useComposite ( ) ;
28
28
29
29
const tabId = getTabId ( baseId , value ) ;
30
+ const panelId = getPanelId ( baseId , value ) ;
30
31
const selected = selectedValue === value ;
31
32
32
33
useIsomorphicEffect ( ( ) => {
@@ -70,6 +71,7 @@ export const TabsTab = (props: PolymorphicProps<"button", TabsTabProps, "type" |
70
71
ref = { refs }
71
72
{ ...buttonProps }
72
73
id = { tabId }
74
+ aria-controls = { selected ? panelId : undefined }
73
75
aria-selected = { ariaAttr ( selected ) }
74
76
data-active = { dataAttr ( selected ) }
75
77
className = { tx ( orientation == "horizontal" ? "-mb-px" : "-me-px" , disabled && "opacity-60" , className ) }
0 commit comments