-
Notifications
You must be signed in to change notification settings - Fork 842
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
[EuiContextMenu] Add "style" prop to context menu #5980
Comments
Hi @p-young, It seems that our documentation is a little bit confusing. If you want to change the width of the panels you can do this: const panels = [
{
id: 0,
title: "This is a context menu",
// You can change the width here
width: 800,
items: [...]
},
{
id: 1,
title: "Nest panels",
// You can change the width here
width: 800,
items: [...]
}
];
<EuiContextMenu width={2000} initialPanelId={0} panels={panels} /> Or just see this CodeSandbox example. Let me know if this is helpful. From the EUI side, we need to improve the documentation. The |
I'm doing something a little different where I want to set the EuiContextMenu width to 100% so that I can use it in two different places, one that is not in a popover and needs to take up the full width of the screen Changing the width of the panels wouldn't be be able to help that because the context menu width is also set I'm achieving this using css for now but as eui is moving to use emotion, it would still be helpful to be able to change the style as needed |
Maybe I'm missing your specific use case, but I'm not 100% sure we would want to support allowing consumers to override the
This is not entirely correct as I mentioned previously - EuiContextMenu sets its style/width based on the |
The In my use case I want the menu to expand to fill the space, so I don't know what the width is (unless I want to use javascript for that but it's easily solved with css 100% width) Exposing the style prop on other components lets users override how the component is designed so I feel like it would be nice here too This is my current solution that I can't get using the props from the menu or panels:
|
@p-young Despite the width being typed as a number, it looks like the actual usage is directly within a If so, I can update our typing to be a less strict |
@constancecchen Tested it with Thanks for the help |
Awesome, thank you for helping us confirm! I'll open a PR now with the quick type fix. |
EuiContextMenu does not have a "style" prop
It would be convenient to have it so that we can modify it the same way as most elastic components, in my case I would like to change the width.
Is there a specific purpose that it's omitted? Thanks!
The text was updated successfully, but these errors were encountered: