-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[List] extract button from ListItem to ListItemButton #26480
Conversation
Co-authored-by: Olivier Tassinari <[email protected]>
@oliviertassinari @eps1lon please review the API, is it looks good to you? I have one hesitation about naming // option 1
<List>
<ListItemButton ButtonBaseProps={{ component: 'a', href: '#id' }}>
</ListItemButton>
</List>
// option 2
<List>
<ListItemButton ButtonProps={{ component: 'a', href: '#id' }}>
</ListItemButton>
</List> I feel that option 2 might mislead user that the |
@siriwatknp With #21453, the consistent API would be: <List>
<ListItemButton componentsProps={{ button: { component: 'a', href: '#id' } }}>
</ListItemButton>
</List> IMHO, it's not great. The direction taken in #26446 looks better from a DX perspective. |
decide to go with #26446 approach. |
closes #13597
closes #26442
Another approach from #26446, please review
ListItemButton.js
Summary
ListItemButton
always render 2 DOM<li class="root"><div class="button"></li>
accept
secondaryAction
as prop (wrapped withListItemSecondaryAction
) instead ofchildren
because it must be the same level as button (not inside).If this api sounds good to the team, will add to
ListItem
so that it does not need to iterate children to find secondary actionI have followed (at least) the PR section of the contributing guide.