12

In the latest version (7.5.x) of React-Table, when using the Material-UI Table components, is there a way to remove the 'Toggle sortBy' tooltip from the column header?

Two tooltips

I have a tooltip with the column header name. both tooltips appear upon hover. Take a look at this codesandbox

Vladi Feldman
  • 872
  • 1
  • 8
  • 16

3 Answers3

22

Adding {...column.getHeaderProps(column.getSortByToggleProps({ title: undefined }))} did the trick.

Here's the updated codesandbox

Vladi Feldman
  • 872
  • 1
  • 8
  • 16
  • 2
    Just for reference, this is due to this line in React Table source code: https://github.com/tannerlinsley/react-table/blob/v7.6.3/src/plugin-hooks/useSortBy.js#L51 – ghybs Feb 10 '21 at 06:22
2

Or just overwrite the title like in:

<span {...column.getGroupByToggleProps()} title="">
Obiwahn
  • 2,677
  • 2
  • 26
  • 36
0

If you want to override it with your own label you can do this. You can also only show the label on columns that can be sorted.

<span {...column.getGroupByToggleProps()} title={column.canSort ? `Sort By ${column.id}` : ""}>
Ade Crown
  • 1,120
  • 14
  • 16