Files
react-test/docs/data/material/components/lists/VirtualizedList.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
903 B
JavaScript
Raw Normal View History

2025-12-12 14:26:25 +09:00
import Box from '@mui/material/Box';
import ListItem from '@mui/material/ListItem';
import ListItemButton from '@mui/material/ListItemButton';
import ListItemText from '@mui/material/ListItemText';
import { List } from 'react-window';
function renderRow(props) {
const { index, style } = props;
return (
<ListItem style={style} key={index} component="div" disablePadding>
<ListItemButton>
<ListItemText primary={`Item ${index + 1}`} />
</ListItemButton>
</ListItem>
);
}
export default function VirtualizedList() {
return (
<Box
sx={{ width: '100%', height: 400, maxWidth: 360, bgcolor: 'background.paper' }}
>
<List
rowHeight={46}
rowCount={200}
style={{
height: 400,
width: 360,
}}
rowProps={{}}
overscanCount={5}
rowComponent={renderRow}
/>
</Box>
);
}