Overview
TableCustom is a powerful table component built on Material React Table (MRT) that provides advanced features including sorting, filtering, pagination, grouping, column visibility control, and data export to Excel and PDF formats.Import
Material-UI & MRT Integration
This component is built on top of Material React Table (MRT), which integrates with Material-UI:Core Props
Array of data objects to display in the table
Array of column definitions following MRT column structure with
header and accessorKey propertiesFeature Control Props
Display & Layout
Enable the top toolbar with search and action buttons
Enable density toggle button (compact/comfortable/spacious)
Enable click-to-copy functionality for table cells
Enable fullscreen toggle button
Pagination
Enable table pagination
Number of rows per page when pagination is enabled
Filtering & Sorting
Enable column filtering
Enable column sorting
Column ID to sort by initially
Column ID to group rows by
Enable column grouping functionality
Column Control
Enable column show/hide functionality
Object controlling which columns are visible (e.g.,
{ columnId: true/false })Callback function when column visibility changes
Selection
Enable row selection with checkboxes
Export
Enable Excel/CSV export button in toolbar
Enable PDF export button in toolbar
Custom Styling
Custom CSS styles for table header cells (MUI sx prop format)
Custom CSS styles for table footer/bottom toolbar (MUI sx prop format)
Custom CSS styles for table container/paper (MUI sx prop format)
Custom CSS styles for top toolbar (MUI sx prop format)
Custom CSS styles for table body cells (MUI sx prop format)
Custom Functions
Function to conditionally change row background color. Receives row object, returns boolean. Yellow background applied if returns true.
Custom button or component to render in the toolbar
Callback function that receives the table instance
When true with
getPage, shows a “clear alerts” button in toolbarUsage Examples
Basic Table
Table with Pagination and Sorting
Table with Filtering and Search
Table with Export Features
Table with Row Selection
Table with Grouping
Table with Grouped Columns
Table with Conditional Row Styling
Table with Custom Toolbar Button
Table with Column Visibility Control
Table with Custom Styling
Full-Featured Table
Column Definition Format
Columns follow the Material React Table format:Export Functionality
Excel/CSV Export
- Exports all table data including grouped columns
- Handles nested column headers
- Formats dates automatically
- Filename:
Excel-export.csv
PDF Export
- Exports current table data
- Includes all visible columns
- Formats dates automatically
- Filename:
pdf-export.pdf
Styling Features
Row Striping
Alternating row colors automatically applied:- Odd rows:
#f9fafbbackground - Even rows:
#f1f5f9background - Hover:
#e2e8f0background
Responsive Density
Default density automatically adjusts based on screen width:- Mobile (< 750px):
compact - Desktop:
comfortable
Localization
Spanish localization included:- “Filas por página” for rows per page
- “Ocultar todo” / “Mostrar todo” for hide/show all columns
- “Escriba su busqueda” for search placeholder
Source Location
/src/components/TableCustom/index.jsx:30
Dependencies
Notes
- Empty tables display a custom “NoRegisterTable” component
- Filter state persists using
storage.get('filter') - Maximum table height is 50000px when pagination is disabled
- Column actions (three-dot menu) are disabled by default
- Column dragging is disabled by default
- Sticky header is enabled for better scrolling experience

