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 | [email protected] | East Daphne |
| Raquel | Kohler | [email protected] | Columbus |
| Ervin | Reinger | [email protected] | South Linda |
| Brittany | McCullough | [email protected] | Lincoln |
| Branson | Frami | [email protected] | New York |
| Ben | Murray | [email protected] | Salt Lake City |
| Elena | Smith | [email protected] | Los Angeles |
| Michael | Johnson | [email protected] | Chicago |
| Sophia | Brown | [email protected] | Houston |
| Lucas | Davis | [email protected] | Phoenix |
| Olivia | Garcia | [email protected] | Philadelphia |
| Liam | Rodriguez | [email protected] | San Antonio |
| Emma | Martinez | [email protected] | San Diego |
| Noah | Hernandez | [email protected] | Dallas |
| Ava | Lopez | [email protected] | San Jose |
| William | Gonzalez | [email protected] | Austin |
| Isabella | Wilson | [email protected] | Jacksonville |
| James | Anderson | [email protected] | Fort Worth |
| Mia | Thomas | [email protected] | Columbus |
| Alexander | Taylor | [email protected] | Charlotte |
| Grace | Moore | [email protected] | Indianapolis |
| Ethan | White | [email protected] | San Francisco |
| Lily | Harris | [email protected] | Seattle |
| Daniel | Martin | [email protected] | Denver |
| Zoe | Jackson | [email protected] | Boston |
| Matthew | Thompson | [email protected] | Nashville |
| Ella | Garcia | [email protected] | Detroit |
| David | Martinez | [email protected] | Portland |
| Aria | Robinson | [email protected] | Las Vegas |
| Joseph | Clark | [email protected] | 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