Open mj12albert opened 1 year ago
Some open questions I have on my mind:
Option
componentv5 uses the same MenuItem
component for Select
options and items in Menu
, Base has a new useOption
that is distinct from useMenu
so we could introduce a new Option
component for material-next (this would be it's own separate issue)
Menu
, introduce Listbox
component?v5 uses the Menu
component for the listbox, if v6 were to use useSelect
it wouldn't make sense as Base's useMenu
has it's own prop getters with a different context. This new component can be completely internal, the important part is detaching from the v5 Menu/MenuList/List
structure
Maybe we just need to share the styles between Menu
and the select Listbox
since they should be identical in terms of the MD3 specs
I think the v6 Select will still depend on InputBase
(and therefore also depends on FormControl
) for the select trigger, since internally it uses OutlinedInput
(or filled
) to share styles with text fields:
// heavily simplified version of what https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Select/Select.js
// would look like in v6
function Select() {
return (
<OutlinedInput // it's essentially `InputBase` with a layer of styles
slots={{
input: SelectInput, // most of the refactoring with useSelect would happen here
}}
slotProps={{
input: {
children,
multiple,
// more props
},
}}
/>
);
}
@mj12albert I agree with both your points 🙌🏼 This would mean trying to get as close as possible to Joy's implementation (which uses Option
and ListBox
components) without breaking changes 🚀
Part of https://github.com/mui/material-ui/issues/29345
Material You specs: https://m3.material.io/components/menus/specs
Migration Guide checklist
useSelect
: WIP #39591Other features & related tasks
Option
component based on@mui/base/useOption
Menu
based on@mui/base/useMenu
for the Select's listboxnative
prop for nativeselect
isn't provided by Base yetmaterial-next
Input components when those are done: https://github.com/mui/material-ui/issues/38374useSelect
usesuseControlledReducer
internally, the warning when switching between controlled/uncontrolled needs to be added back (this comment)Divider
https://github.com/mui/material-ui/issues/39007ListSubheader
, should v6 replace it with aOptionGroup
component? (This would be a breaking change, and also not in the MD3 spec)SelectField
component https://github.com/mui/material-ui/issues/21782label
with non-nativeSelect
https://github.com/mui/material-ui/issues/38869#issuecomment-1792184844