Skip to content
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

DropdownMenu: Unable to add style or className to the Menu component without a custom menuRenderer #989

Closed
wpatter6 opened this issue Oct 23, 2020 · 1 comment
Milestone

Comments

@wpatter6
Copy link

wpatter6 commented Oct 23, 2020

I'd like to be able to add a class name to the .rmd-menu component on the dropdown menu, but I'm not seeing any props on the interface that look like they'd be for that. Is it possible?

@mlaursen mlaursen changed the title DropdownMenu: Possible to add a class name to the item container? DropdownMenu: Unable to add style or className to the Menu component without a custom menuRenderer Oct 23, 2020
@mlaursen
Copy link
Owner

mlaursen commented Oct 23, 2020

Whoops. This is a bug on my part since I really limited the props allowed to be passed to the menu in this component. I'll add menuStyle and menuClassName to the DropdownMenu to fix this.

The current (ugly) workaround would be to do something like this:

import { DropdownMenu, defaultMenuRenderer } from '@react-md/menu';

const customMenuRenderer = (props) => defaultMenuRenderer({ ...props, className: 'your-custom-classes' });

...

<DropdownMenu {...dropdownMenuProps} menuRenderer={customMenuRenderer} />;

@mlaursen mlaursen added this to the 2.4.2 milestone Oct 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants