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

Unable to add custom element in MenuItem #408

Closed
UBy opened this issue Mar 9, 2015 · 4 comments
Closed

Unable to add custom element in MenuItem #408

UBy opened this issue Mar 9, 2015 · 4 comments
Labels
component: menu This is the name of the generic UI component, not the React module!

Comments

@UBy
Copy link

UBy commented Mar 9, 2015

Currently it is not possible to add an element of your own choice to the LeftNav component.
MenuItems can be link (route, payload), icon, text (item, data, number) and toggle. This is only enough if you want basic router/URL functionality. The following code would enable any type of content in the LeftNav:

if (this.props.element !== undefined) element = this.props.element;
....
return (
  React.createElement("div", {
    key: this.props.index, 
    className: classes, 
    onTouchTap: this._handleTouchTap, 
    onClick: this._handleOnClick}, 

    icon, 
    this.props.children, 
    data,
    element, <-----
    attribute, 
    number, 
    toggle, 
    iconRight    
  )
@jgable
Copy link

jgable commented Mar 11, 2015

I think you can put custom content in if you don't specify a type for the menu item and set the content to the text property.

Check the code here

@UBy
Copy link
Author

UBy commented Mar 11, 2015

Thanks. I already tried with the text property, but if I remember correctly, my HTML got escaped. I will check if leaving out the type makes a difference.

@jgable
Copy link

jgable commented Mar 11, 2015

It does, I'm using it already.

@UBy
Copy link
Author

UBy commented Mar 12, 2015

It does work! although a new complication has arisen. I can put a TextField in the LeftNav, but clicking on it is interpreted as a click outside the nav and will close it. Anyway that's a different problem, so I'll close this issue.

@UBy UBy closed this as completed Mar 12, 2015
@oliviertassinari oliviertassinari added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 25, 2022
@zannager zannager added component: menu This is the name of the generic UI component, not the React module! and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: menu This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

4 participants