@@ -7,6 +7,7 @@ import { usePathname } from "next/navigation";
77import { useCallback , useRef , useState } from "react" ;
88import { ScrollShadow } from "./ScrollShadow/ScrollShadow" ;
99import { Button } from "./button" ;
10+ import { ToolTipLabel } from "./tooltip" ;
1011
1112export type TabLink = {
1213 name : string ;
@@ -82,6 +83,7 @@ export function TabButtons(props: {
8283 isActive : boolean ;
8384 isDisabled ?: boolean ;
8485 icon ?: React . FC < { className ?: string } > ;
86+ toolTip ?: string ;
8587 } [ ] ;
8688 tabClassName ?: string ;
8789 activeTabClassName ?: string ;
@@ -111,26 +113,32 @@ export function TabButtons(props: {
111113 >
112114 { props . tabs . map ( ( tab , index ) => {
113115 return (
114- < Button
115- // biome-ignore lint/suspicious/noArrayIndexKey: tabs don't change order, so index is stable
116- key = { index }
117- variant = "ghost"
118- ref = { tab . isActive ? activeTabRef : undefined }
119- className = { cn (
120- "relative inline-flex h-auto items-center gap-1.5 rounded-lg px-2 font-medium text-sm hover:bg-accent lg:px-3 lg:text-base" ,
121- ! tab . isActive &&
122- "text-muted-foreground hover:text-foreground" ,
123- tab . isDisabled && "cursor-not-allowed opacity-50" ,
124- props . tabClassName ,
125- tab . isActive && props . activeTabClassName ,
126- ) }
127- onClick = { ! tab . isDisabled ? tab . onClick : undefined }
116+ < ToolTipLabel
117+ key = { typeof tab . name === "string" ? tab . name : index }
118+ label = { tab . toolTip }
119+ hoverable = { tab . isDisabled }
128120 >
129- { tab . icon && (
130- < tab . icon className = { cn ( "size-6" , props . tabIconClassName ) } />
131- ) }
132- { tab . name }
133- </ Button >
121+ < Button
122+ variant = "ghost"
123+ ref = { tab . isActive ? activeTabRef : undefined }
124+ className = { cn (
125+ "relative inline-flex h-auto items-center gap-1.5 rounded-lg px-2 font-medium text-sm hover:bg-accent lg:px-3 lg:text-base" ,
126+ ! tab . isActive &&
127+ "text-muted-foreground hover:text-foreground" ,
128+ tab . isDisabled && "cursor-not-allowed opacity-50" ,
129+ props . tabClassName ,
130+ tab . isActive && props . activeTabClassName ,
131+ ) }
132+ onClick = { ! tab . isDisabled ? tab . onClick : undefined }
133+ >
134+ { tab . icon && (
135+ < tab . icon
136+ className = { cn ( "size-6" , props . tabIconClassName ) }
137+ />
138+ ) }
139+ { tab . name }
140+ </ Button >
141+ </ ToolTipLabel >
134142 ) ;
135143 } ) }
136144 </ div >
0 commit comments