-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optional spacing between IconMenu Popover and its anchor icon/button #2760
Comments
+1 |
@willemx - for you use case you just need to adjust the anchor and target to suit. A bottom-left target with a top-left anchor will have the menu open immediately below the button. I think @zuk is looking for the ability to add some spacing between the button and the popover. If that' can't be sone with styling ((I haven't tried), then a custom component isn't difficult. |
Thanks @mbrookes, that solved 97% of my problem. |
There is a props called |
I agree that there should be an offset option. Adding padding around the button's container to adjust the position isn't always feasible without altering the design. Manually setting the Popover's position is also complex because you have to calculate the position on mount and every time the browser window resizes or the popover's content size changes. Edit: I figured out that I could adjust the position using CSS transform on a class, then passing that class to the Popover. |
This things do the trick for me // adding 2rem gap to right
const useGapStyles = makeStyles({
paper: {
marginLeft: "-2rem"
}
});
...
// inside the component
const classes = useGapStyles();
<Popover
classes={{ paper: classes.paper }}
...
/> |
This trick works for me. <Popover
....
sx={{ transform: 'translate(0px, -20px)' }}
> |
I'm trying to add some space between the
Popover
generated byIconMenu
and its anchorFloatingActionButton
. That is, I want the menu to appear a few pixels above the anchored icon, rather than directly above it.I've tried just about every CSS trick on the
style
,menuStyle
, andiconStyle
property, but no dice. Doing it with the various style properties doesn't work because there doesn't seem to be a way to apply a custom style to the popover container, and it can't be done with CSS selectors because thePopover
gets added to the document root and has no distinguishing CSS class or any other way to make it targetable.Am I missing something? Is there some easy way to do this? Or do I have to implement a custom version of
IconMenu
to do it?The text was updated successfully, but these errors were encountered: