Reputation: 220
I have 100's of data to show using Accordion (material-ui) inside a Box component, but not sure how to manipulate the built in styles to set the maxHeight. Is there a way that I can control the styles instead of showing all movies when the dropdown is clicked?
Upvotes: 1
Views: 3642
Reputation: 1
I used the sx prop to achieve the desired result. Check out the following code:
<AccordionDetails sx={{ display: 'flex', maxHeight: "50vh",overflowY: "scroll"}}
{someList}
</AccordionDetails>
Upvotes: 0
Reputation: 657
I have created the answer with sandbox.url I have used sx prop and overflowy to scroll.
Upvotes: 1
Reputation: 1185
Add this style in your css file and make height according your requirement, it works!
.MuiAccordionDetails-root {
max-height: 300px;
overflow-y: scroll;
}
codesandbox link: https://codesandbox.io/s/react-typescript-forked-pc3udc?file=/src/styles.css:59-132
Upvotes: 4