@@ -13,6 +13,7 @@ type TabProps = Pick<
1313 | "onKeyUp"
1414 | "aria-selected"
1515 | "aria-checked"
16+ | "id"
1617> & {
1718 label ?: string | number
1819 tooltip ?: string
@@ -95,6 +96,7 @@ const Tab = forwardRef(
9596)
9697
9798export type TabListProps = {
99+ id ?: string
98100 children : React . ReactNode
99101 className ?: string
100102 style ?: React . CSSProperties
@@ -116,7 +118,7 @@ const tabListBottomClassName =
116118 */
117119const TabList = forwardRef (
118120 (
119- { children, className, style, testId, side = "top" } : TabListProps ,
121+ { children, className, style, testId, side = "top" , id } : TabListProps ,
120122 ref : ForwardedRef < HTMLDivElement > ,
121123 ) => {
122124 const tabListChildrenWithValue = React . Children . map (
@@ -163,6 +165,7 @@ const TabList = forwardRef(
163165 ) ,
164166 className ,
165167 ) }
168+ id = { id }
166169 style = { style }
167170 data-testid = { testId }
168171 ref = { ref }
@@ -179,6 +182,7 @@ const TabList = forwardRef(
179182)
180183
181184type TabPanelProps = {
185+ id ?: string
182186 label ?: string | number
183187 children : React . ReactNode
184188 className ?: string
@@ -188,14 +192,15 @@ type TabPanelProps = {
188192
189193const TabPanel = forwardRef (
190194 (
191- { label, children, className, style, testId } : TabPanelProps ,
195+ { label, children, className, style, testId, id } : TabPanelProps ,
192196 ref : ForwardedRef < HTMLDivElement > ,
193197 ) => {
194198 if ( label === undefined || label === null || label === "" ) {
195199 throw new Error ( "TabPanel must have a label prop" )
196200 }
197201 return (
198202 < RTabs . Content
203+ id = { id }
199204 className = { twMerge ( "data-[state=inactive]:hidden" , className ) }
200205 style = { style }
201206 value = { label . toString ( ) } /* this is set in the Tabs component! */
@@ -227,7 +232,7 @@ const Container = forwardRef(
227232 selected ?: number | string | null | undefined
228233 defaultSelected ?: number | string
229234 onChange ?: ( value : string ) => void
230- children : React . ReactNodeArray
235+ children : React . ReactNode [ ]
231236 className ?: string
232237 style ?: React . CSSProperties
233238 testId ?: string
0 commit comments