UNPKG

materialuiupgraded

Version:

Material-UI's workspace package

60 lines (35 loc) 2.81 kB
--- title: Table React component components: Table, TableBody, TableCell, TableFooter, TableHead, TablePagination, TableRow, TableSortLabel --- # Tables <p class="description">Data tables display sets of data. They can be fully customized.</p> [Data tables](https://material.io/design/components/data-tables.html) display information in a way that’s easy to scan, so that users can look for patterns and insights. They can be embedded in primary content, such as cards. Data tables can include: - A corresponding visualization - Navigation - Tools to query and manipulate data When including tools, they should be placed directly above or below the table. ## Structure A data table contains a header row at the top that lists column names, followed by rows for data. Checkboxes should accompany each row if the user needs to select or manipulate data. For accessibility, the first column is set to be a `<th>` element, with a `scope` of `"row"`. This enables screen readers to identify a cell's value by it's row and column name. ## Simple Table A simple example with no frills. {{"demo": "pages/demos/tables/SimpleTable.js"}} ## Sorting & Selecting This example demonstrates the use of `Checkbox` and clickable rows for selection, with a custom `Toolbar`. It uses the `TableSortLabel` component to help style column headings. The Table has been given a fixed width to demonstrate horizontal scrolling. In order to prevent the pagination controls from scrolling, the TablePagination component is used outside of the Table. (The ['Custom Table Pagination Action' example](#custom-table-pagination-action) below shows the pagination within the TableFooter.) {{"demo": "pages/demos/tables/EnhancedTable.js"}} ## Custom Table Pagination Action The `Action` property of the `TablePagination` component allows the implementation of custom actions. {{"demo": "pages/demos/tables/CustomPaginationActionsTable.js"}} ## Customized Tables You can customize the look and feel of the table by overriding the styles of the `TableCell` component. {{"demo": "pages/demos/tables/CustomizedTable.js"}} ## Advanced use cases For more advanced use cases you might be able to take advantage of: - [dx-react-grid-material-ui](https://devexpress.github.io/devextreme-reactive/react/grid/) A data grid for Material-UI with paging, sorting, filtering, grouping and editing features ([custom license](https://js.devexpress.com/licensing/)). - [mui-datatables](https://github.com/gregnb/mui-datatables) Responsive data tables for Material-UI with filtering, sorting, search and more. - [material-table](https://github.com/mbrn/material-table) DataTable based on table component with additional features like search, filtering, sorting and much more.