我正在try 使用Style函数设置Select MUI组件的样式.因为我想在以后分享这种风格,所以我不想继续使用SX.我try 了几种方法,但我没有找到合适的类来直接从带样式的函数中定位Paper
// Styled
export const StyledSelect = styled(Select)<SelectProps>(({ theme }) => ({
textAlign: 'start',
margin: '5px',
fontWeight: 800,
'& .MuiSelect-select': {
// List
'& .MuiList-root': {
color: 'green',
backgroundColor: 'red',
},
// Paper
'& .MuiMenu-paper': {
backgroundColor: 'red',
},
},
})
// Component
<FormControl>
<StyledSelect
variant={variant}
labelId='select-label'
// This works 100%
// MenuProps={{
// PaperProps: {
// sx: {
// backgroundColor: 'transparent',
// backdropFilter: 'blur(10px)',
// },
// },
// }}
name={name}
disabled={disabled}
value={value}
onChange={onChangeFn}
displayEmpty
>
</StyledSelect>
</FormControl>