Skip to content

Commit

Permalink
fix (api): add asChild prop to popper.content
Browse files Browse the repository at this point in the history
  • Loading branch information
decipher-cs committed Jan 21, 2025
1 parent 8b55679 commit 8de427e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/tools/Popper/fragments/PopperContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import Primitive from '~/core/primitives/Primitive';

export type PopperContentProps = PropsWithChildren<{
className?: string;
asChild?: boolean;
}>;

export default function PopperContent({ className = '', children }: PopperContentProps) {
export default function PopperContent({ asChild, className = '', children }: PopperContentProps) {
const { isOpen, rootClass, floatingArrowRef: arrowRef, floating, interactions: { getFloatingProps }, showArrow } = usePopper();

const { refs: { setFloating }, floatingStyles, context } = floating;
Expand All @@ -17,7 +18,7 @@ export default function PopperContent({ className = '', children }: PopperConten

return (
<FloatingPortal root={document.body}>
<Primitive.div asChild={isValidElement(children)} className={clsx(`${rootClass}-floating-element`, className)} ref={setFloating} style={floatingStyles} {...getFloatingProps()} >
<Primitive.div asChild={asChild} className={clsx(`${rootClass}-floating-element`, className)} ref={setFloating} style={floatingStyles} {...getFloatingProps()} >
{showArrow && <FloatingArrow className={clsx(`rad-ui-arrow ${rootClass}-arrow`)} ref={arrowRef} context={context} />}
{children}
</Primitive.div>
Expand Down

0 comments on commit 8de427e

Please sign in to comment.