Scrollable List Component from Material-UI in React

optional picture optional · May 4, 2017 · Viewed 50.2k times · Source

How to make the List component (see http://www.material-ui.com/#/components/list) fixed-size and scrollable? Every time I add a new ListItem the List expands, however I would like to be able to scroll through it if content gets bigger than the container.

Answer

optional picture optional · May 4, 2017

I just found out that you can add properties. 'maxHeight' and 'overflow' are the ones I was needing to solve my problem. For example for a List in a Paper container:

<Paper style={{maxHeight: 200, overflow: 'auto'}}>
  <List>
   ...
  </List>
</Paper>