that padding is coming from the .MuiList-padding
which is the default padding in the Menu
. Use the MenuProps
prop to pass the props down to Menu
. Then target the list
class using classes
property.
<Select
MenuProps={{ classes: { list: classes.list } }}
id="demo-simple-select-outlined"
value={selectedOne}>
{myList.map((ele, index) => (
<MenuItem key={ele} value={ele} style={{ background: "grey" }}>
{ele}
</MenuItem>
))}
</Select>
const useStyles = makeStyles((theme) => ({
list:{
padding:0
}
}));
Here is the working demo:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…