Sticky Header Example
Material React Table allows you to easily make the header and footer sticky while scrolling. See the Sticky Header Feature Guide for more information.
First Name | Last Name | Email | City |
---|---|---|---|
Dylan | Murray | dmurray@yopmail.com | East Daphne |
Raquel | Kohler | rkholer33@yopmail.com | Columbus |
Ervin | Reinger | ereinger@mailinator.com | South Linda |
Brittany | McCullough | bmccullough44@mailinator.com | Lincoln |
Branson | Frami | bframi@yopmain.com | New York |
Ben | Murray | benm@email.com | Salt Lake City |
Elena | Smith | esmith@yopmail.com | Los Angeles |
Michael | Johnson | mjohnson@mailinator.com | Chicago |
Sophia | Brown | sbrown@yopmail.com | Houston |
Lucas | Davis | ldavis@mailinator.com | Phoenix |
Olivia | Garcia | ogarcia@yopmail.com | Philadelphia |
Liam | Rodriguez | lrodriguez@mailinator.com | San Antonio |
Emma | Martinez | emartinez@yopmail.com | San Diego |
Noah | Hernandez | nhernandez@mailinator.com | Dallas |
Ava | Lopez | alopez@yopmail.com | San Jose |
William | Gonzalez | wgonzalez@mailinator.com | Austin |
Isabella | Wilson | iwilson@yopmail.com | Jacksonville |
James | Anderson | janderson@mailinator.com | Fort Worth |
Mia | Thomas | mthomas@yopmail.com | Columbus |
Alexander | Taylor | ataylor@mailinator.com | Charlotte |
Grace | Moore | gmoore@yopmail.com | Indianapolis |
Ethan | White | ewhite@mailinator.com | San Francisco |
Lily | Harris | lharris@yopmail.com | Seattle |
Daniel | Martin | dmartin@mailinator.com | Denver |
Zoe | Jackson | zjackson@yopmail.com | Boston |
Matthew | Thompson | mthompson@mailinator.com | Nashville |
Ella | Garcia | egarcia@yopmail.com | Detroit |
David | Martinez | dmartinez@mailinator.com | Portland |
Aria | Robinson | arobinson@yopmail.com | Las Vegas |
Joseph | Clark | jclark@mailinator.com | Baltimore |
First Name | Last Name | City |
1import { useMemo } from 'react';2import {3 MaterialReactTable,4 useMaterialReactTable,5 type MRT_ColumnDef,6} from 'material-react-table';7import { data, type Person } from './makeData';89const Example = () => {10 const columns = useMemo<MRT_ColumnDef<Person>[]>(11 //column definitions...36 );3738 const table = useMaterialReactTable({39 columns,40 data,41 enableBottomToolbar: false,42 enableStickyHeader: true,43 enableStickyFooter: true,44 enablePagination: false,45 muiTableContainerProps: { sx: { maxHeight: '400px' } },46 muiTableBodyCellProps: {47 sx: (theme) => ({48 backgroundColor:49 theme.palette.mode === 'dark'50 ? theme.palette.grey[900]51 : theme.palette.grey[50],52 }),53 },54 });5556 return <MaterialReactTable table={table} />;57};5859export default Example;60
View Extra Storybook Examples