Reputation: 400
I am using Material UI 5 in a new project and I need to style an ul
item.
I am trying to style the ul
item using the sx
prop, but it doesn't work, my code is the following:
<ul
sx={{
padding: "0 0",
listStyle: "none",
display: "grid",
gap: "30px",
gridTemplateColumns: "repeat(2, 1fr)",
}}
>
what should I do?
Thanks in advance.
Upvotes: 1
Views: 2115
Reputation: 2858
you should use Box
component to create wrapper. check https://mui.com/components/box/
<Box component="ul"
sx={{
padding: "0 0",
listStyle: "none",
display: "grid",
gap: "30px",
gridTemplateColumns: "repeat(2, 1fr)",
}}
>
<Box component="li">Item 1</Box>
<Box component="li">Item 2</Box>
</Box>
Upvotes: 2
Reputation: 130
ul is not a Mui Component but a classic jsx component, so you can attach the classic style instead i think
<ul
style={{
padding: "0 0",
listStyle: "none",
display: "grid",
gap: "30px",
gridTemplateColumns: "repeat(2, 1fr)",
}}
>
Upvotes: 3