Files
react-test/docs/data/joy/components/list/StickyList.js

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

30 lines
896 B
JavaScript
Raw Normal View History

2025-12-12 14:26:25 +09:00
import List from '@mui/joy/List';
import ListItem from '@mui/joy/ListItem';
import ListSubheader from '@mui/joy/ListSubheader';
import ListItemButton from '@mui/joy/ListItemButton';
import Sheet from '@mui/joy/Sheet';
export default function StickyList() {
return (
<Sheet
variant="outlined"
sx={{ width: 320, maxHeight: 300, overflow: 'auto', borderRadius: 'sm' }}
>
<List>
{[...Array(5)].map((_, categoryIndex) => (
<ListItem nested key={categoryIndex}>
<ListSubheader sticky>Category {categoryIndex + 1}</ListSubheader>
<List>
{[...Array(10)].map((__, index) => (
<ListItem key={index}>
<ListItemButton>Subitem {index + 1}</ListItemButton>
</ListItem>
))}
</List>
</ListItem>
))}
</List>
</Sheet>
);
}