import Table from '@mui/joy/Table'; import Typography from '@mui/joy/Typography'; import Sheet from '@mui/joy/Sheet'; function createData(name, calories, fat, carbs, protein) { return { name, calories, fat, carbs, protein }; } const rows = [ createData('1', 159, 6.0, 24, 4.0), createData('2', 237, 9.0, 37, 4.3), createData('3', 262, 16.0, 24, 6.0), createData('4', 305, 3.7, 67, 4.3), createData('5', 356, 16.0, 49, 3.9), createData('6', 159, 6.0, 24, 4.0), createData('7', 237, 9.0, 37, 4.3), createData('8', 262, 16.0, 24, 6.0), createData('9', 305, 3.7, 67, 4.3), createData('10', 356, 16.0, 49, 3.9), ]; export default function TableScrollingShadows() { return (
The table body is scrollable. ({ '--TableCell-height': '40px', // the number is the amount of the header rows. '--TableHeader-height': 'calc(1 * var(--TableCell-height))', height: 200, overflow: 'auto', background: `linear-gradient(${theme.vars.palette.background.surface} 30%, rgba(255, 255, 255, 0)), linear-gradient(rgba(255, 255, 255, 0), ${theme.vars.palette.background.surface} 70%) 0 100%, radial-gradient( farthest-side at 50% 0, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0) ), radial-gradient( farthest-side at 50% 100%, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0) ) 0 100%`, backgroundSize: '100% 40px, 100% 40px, 100% 14px, 100% 14px', backgroundRepeat: 'no-repeat', backgroundAttachment: 'local, local, scroll, scroll', backgroundPosition: '0 var(--TableHeader-height), 0 100%, 0 var(--TableHeader-height), 0 100%', backgroundColor: 'background.surface', })} > {rows.map((row) => ( ))}
Row Calories Fat (g) Carbs (g) Protein (g)
{row.name} {row.calories} {row.fat} {row.carbs} {row.protein}
); }