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

ListItem link? #1823

Closed
sys13 opened this issue Oct 7, 2015 · 3 comments
Closed

ListItem link? #1823

sys13 opened this issue Oct 7, 2015 · 3 comments
Labels
component: list This is the name of the generic UI component, not the React module!

Comments

@sys13
Copy link

sys13 commented Oct 7, 2015

How do I make a ListItem into a link?

I tried wrapping it with an achor tag but that didn't work. I didn't see a property in http://material-ui.com/#/components/lists. I would prefer to avoid using event handlers so that the hover shows a URL.

@rhythnic
Copy link

I'm having the opposite problem. I would like it prevent it from rendering as a link. I'm getting a nested link error when using an IconMenu with MenuItems inside of a ListItem. Its working in the docs though, so maybe I'm doing something wrong.

ListItem > EnhancedButton > a > ... > IconMenu > ReactTransitionGroup > Menu > MenuItem > ListItem > EnhancedButton > a.

Is there any way to prevent this? I know it's a different problem than @sys13, but it might have the same solution.

@DaxChen
Copy link

DaxChen commented Dec 29, 2015

Use the containerElement with linkButton props!

see:
http://stackoverflow.com/questions/32106513/material-ui-menu-using-routes/34507786#34507786

<MenuItem
  linkButton
  containerElement={<Link to="/profile" />}
  primaryText="Profile"
  leftIcon={
    <FontIcon className="material-icons">people</FontIcon>
  } />

or if you're not using react-router, simply use

<MenuItem linkButton href="/profile" primaryText="Profile" />

alitaheri added a commit to alitaheri/material-ui that referenced this issue Dec 29, 2015
This has caused many issues, when an <a> element is created in this component there will be no way to support links, as nested <a> elements is offensive in the eyes of HTML.

Closes mui#2178, mui#1979, mui#1823
alitaheri added a commit to alitaheri/material-ui that referenced this issue Dec 30, 2015
This has caused many issues, when an <a> element is created in this component there will be no way to support links, as nested <a> elements is offensive in the eyes of HTML.

Closes mui#2178, mui#1979, mui#1823
@alitaheri
Copy link
Member

This was fixed in #2708

@zannager zannager added the component: list This is the name of the generic UI component, not the React module! label Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: list This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

5 participants