diff --git a/packages/react/src/tooltip/tooltip.tsx b/packages/react/src/tooltip/tooltip.tsx index 0d842d7..b3a29e2 100644 --- a/packages/react/src/tooltip/tooltip.tsx +++ b/packages/react/src/tooltip/tooltip.tsx @@ -4,6 +4,7 @@ import * as RadixTooltip from '@radix-ui/react-tooltip'; import { createContext, type FC, + forwardRef, type PropsWithChildren, useContext, useState, @@ -60,41 +61,51 @@ export interface TooltipContentProps extends RadixTooltip.TooltipContentProps { hideArrow?: boolean; } -const Content: FC = (props) => { - const { children, hideArrow = false, size = 'md', ...rest } = props; - const context = useContext(TooltipContext); +const Content = forwardRef( + (props, userRef) => { + const { children, hideArrow = false, size = 'md', ...rest } = props; + const context = useContext(TooltipContext); - return ( - - {context.open ? - - + {context.open ? + - {!hideArrow ? - - : null} -
{children}
-
-
- : null} -
- ); -}; + + {!hideArrow ? + + : null} +
+ {children} +
+
+ + : null} + + ); + }, +); const Root: FC = (props) => { const {