Open raymondsze opened 5 years ago
I agree, I think that it's something we should implement and use in our documentation website.
Google has customized the style, it would make a great customization example:
Do you think it should be an enhancenent of MenuItem/ListItem or a seperate implementation?
I guess this is asking for the implementation of https://material.io/design/shape/about-shape.html?
We have a couple of different efforts and issue on the List component, I think that it would be great to align them, cc @mbrookes:
I have made a quick POC to get an idea on the options we have:
What about:
We follow the MenuItem pattern, we introduce a new DrawerListItem component, it's a drop in replacement for the ListItem component. It has a custom handling of the selected property as shown in the previous git diff. If somebody wants its drawer list to be keyboard navigable, it replaces the List component with the MenuList component?
Alternative strategy:
Standardise on a single List and ListItem component. Add variants for Drawer and Menu. Add a disableAccessibility
(😜) prop to disable Menu style keyboard navigation.
We would need to wait for 4.1 for deprecation of MenuList and MenuListItem, however it could be implemented now, with MenuList and MenuListItem becoming a thin wrapper that sets the List variant, with deprecation added later. (Or, the wrappers could become permanent for API stability...)
variant: "nav"
may not be suitable?
The MWC has this kind of style for Menu of SelectField as well. For that case, the parent component is ul
but with primary
style. Although Material-UI does not necessary to follow MWC.
We explore this problem further in #22780 for the requirements of the documentation. This will be a great starting point to work on this issue. There is a decision to take between bundling the style inside ListItem (1), creating a new component that extends ListItem (2), or creating a new component without ListItem (3).
With hindsight, I think that we should have used option 3 for the Menu: it helps customization (fewer layers of abstraction, style often different) and performance (fewer components, especially relevant with lists).
Drawer MenuItem: https://material-components.github.io/material-components-web-catalog/#/component/drawer Demo: https://material-components.github.io/material-components-web-catalog/#/component/drawer
Shape: https://material.io/design/shape/about-shape.html#shape-customization-tool
Benchmark