Skip to content

Commit a7e6225

Browse files
committed
feat(tooltip): tooltip for tables
Signed-off-by: Sudhanshu Dasgupta <dasguptashivam23@gmail.com>
1 parent b18a230 commit a7e6225

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/custom/CustomTooltip/customTooltip.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function CustomTooltip({
5050
onClick={onClick}
5151
{...props}
5252
>
53-
{children}
53+
<div>{children}</div>
5454
</Tooltip>
5555
);
5656
}

src/custom/ResponsiveDataTable.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import { Theme, ThemeProvider, createTheme } from '@mui/material';
22
import MUIDataTable from 'mui-datatables';
33
import React, { useCallback } from 'react';
4+
import { CustomTooltip } from './CustomTooltip';
45

56
const dataTableTheme = (theme: Theme) =>
67
createTheme({
8+
...theme,
79
components: {
10+
...theme.components,
811
MuiTable: {
912
styleOverrides: {
1013
root: {
@@ -253,7 +256,10 @@ const ResponsiveDataTable = ({
253256
columns={tableCols ?? []}
254257
data={data || []}
255258
title={undefined}
256-
components={components}
259+
components={{
260+
Tooltip: CustomTooltip as unknown as React.ReactNode,
261+
...components
262+
}}
257263
options={updatedOptions}
258264
{...props}
259265
/>

0 commit comments

Comments
 (0)