diff --git a/.changeset/hot-jobs-marry.md b/.changeset/hot-jobs-marry.md new file mode 100644 index 00000000000..9d0fb77920d --- /dev/null +++ b/.changeset/hot-jobs-marry.md @@ -0,0 +1,5 @@ +--- +"@primer/react": minor +--- + +Add forward ref to Popover diff --git a/packages/react/src/Popover/Popover.tsx b/packages/react/src/Popover/Popover.tsx index 3f6c9b3c784..760aac62f8b 100644 --- a/packages/react/src/Popover/Popover.tsx +++ b/packages/react/src/Popover/Popover.tsx @@ -53,18 +53,16 @@ export type PopoverProps = { } & StyledPopoverProps & HTMLProps -const Popover: React.FC> = ({ - className, - caret = 'top', - open, - relative, - ...props -}) => { +const Popover = React.forwardRef(function Popover( + {className, caret = 'top', open, relative, ...props}, + forwardRef, +) { const enabled = useFeatureFlag(CSS_MODULES_FLAG) if (enabled) { return ( > = ({ } return -} +}) +Popover.displayName = 'Popover' const StyledPopoverContent = toggleStyledComponent( CSS_MODULES_FLAG,