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 has link ? #1404
Comments
@TonyFrancis You should be able to add an |
@TonyFrancis Got your comment on gitter and it sounds like you got this to work. I'll go ahead and close this for now - please reopen if there's still an issue. |
|
Edit: Based on @TonyFrancis response the href doesn't fully satisfy the need. If you're using react router which is likely where the For example if you have
would link to |
The documentation is not clear enough for me. hmmm |
There is no href field in the document for ListItem |
Just ran into this. I'm using this and it works:
|
@mariotacke ^ this code generates edit: it's fine if the parent is a |
Now, you can create this with following code:
|
Hey @Glaadiss Tnx, it works |
@Glaadiss that markup gives me an error:
Is that because I have an outdated version of React or MUI? |
@renannobile Check out if you passing unnecessary |
@Glaadiss I don't seem to be able to use this on 1.0.0-beta.44 Tried:
The above case works but without the ripple effect and it results in an
The above case works but without the ripple effect and it results in an item without visible text.
This above case shows an [object Object] attribute for containerElement in the HTML.
|
Ahh! The solution is this.
|
@mschipperheyn this works but it messes with the ripple effect |
Hello, any updates on how to properly do this? |
This works for me, including ripple: <ListItem button component={
({ children, ...props }) =>
<Link to="/" {...props as LinkProps}>
{children}
</Link>
}> |
The following approach worked for me, because it's able to retain the original style and flex behavior. <ListItem component={props => (
<ListItem button>
<Link style={{
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0
}}
to={"/"}>
</Link>
{props.children}
</ListItem>
)}>
<ListItemIcon>
<ArrowForwardIcon/>
</ListItemIcon>
<ListItemText primary="List Item" />
</ListItem> |
For Next.js users: <List component="nav">
<Link href="/admin/resources" passHref>
<ListItem component="a" button>
<ListItemIcon>
<InboxIcon />
</ListItemIcon>
<ListItemText primary="Resources" />
</ListItem>
</Link>
... |
This may seem obvious - but if you don't need to use
|
By default Eslint should require
|
This works with v4: <ListItem button to={to} component={Link}>
{children}
</ListItem> |
Here's my approach, using built-in <ListItem
button
component={NavLink}
activeClassName={"Mui-selected"}
to={"/some-url"}
exact
>
...
</ListItem> |
Link not working with ListItem pls help me antone |
@gautam751 share your code or repo, please, so that people can help you |
Worked for Me,Thanks
|
Consider: <ListItem component={props => <Link {...props} to="/about" />}>
// ...
</ListItem> More info: |
For any future readers. Here's the approach I use with Remix & Joy UI:
|
I am trying to use Listitem as link to other url but Link's property override ListItem 's property
is there any solution to this
The text was updated successfully, but these errors were encountered: