How show Menu at a specific position? #34567
-
Hello! Thank you for this great project. The use case is displaying a ContextMenu via right-click. May be related to #17206. I implemented it like this: // Page root element
const target = document.getElementById("root");
// Offset on screen
const offsetX = 100;
const offsetY = 200;
const offset: PositioningProps["offset"] = ({ positionedRect, targetRect, position, alignment }) => {
return { crossAxis: offsetX - targetRect.x, mainAxis: offsetY - targetRect.y };
};
<Menu
positioning={{
target,
position: "below",
align: "start",
coverTarget: true,
autoSize: true,
offset
}}
>
...
</Menu> Is there any other code you would recommend? |
Beta Was this translation helpful? Give feedback.
Answered by
layershifter
Jun 2, 2025
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
lriki
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://react.fluentui.dev/?path=/docs/concepts-developer-positioning-components--docs#imperative-anchor-target