parent
Description
Optional. An HTML element relative to which the popup will be positionedUsage
parent?: HTMLElement;
Example
function Example() {
const nodeRef = useRef<HTMLElement | null>(null);
const [isOpen, setIsOpen] = useState(false);
const showPopup = () => setIsOpen(true);
return (
<div ref={nodeRef}>
<Button type="block" onClick={showPopup}>Show next to button</Button>
{isOpen && (
<Popup parent={nodeRef.current}>
<p>Some text</p>
</Popup>
)}
</div>
);
}