material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

[Table] table cell hover tooltip

Open mauvew opened this issue 10 years ago • 12 comments

Problem description

Is it possible to provide the feature that when the cursor hovers to the table cell in the Table component, a tooltip appears and display the content of the cell. Like the following pic shows, if there is no tooltip, some part of the content will not be visible. Or any suggestion on how to deal with this situation?

image

Versions

  • Material-UI: 0.16.1
  • React:
  • Browser:

mauvew avatar Oct 24 '16 13:10 mauvew

Looking for a suggestion as well to make the tooltip more visible in a table. Possibly center-left or center-right?

TheoNolasco avatar Oct 24 '16 17:10 TheoNolasco

+1 on this.

lorenzoid avatar Jan 26 '17 18:01 lorenzoid

+1

noopnik avatar Feb 15 '17 11:02 noopnik

As of release v.0.17.0, we can now use tooltipPosition: 'center-right' due to #6072. Good fix!

m2mathew avatar Feb 28 '17 17:02 m2mathew

Hey guys! this is a good idea but it is not quite working. I'm getting these warnings:

Invalid prop tooltipPositionof valuecenter-rightsupplied toIconButton, expected one of ["bottom-center","bottom-left","bottom-right","top-center","top-left","top-right"]

and

Invalid prop verticalPositionof valuecentersupplied toTooltip, expected one of ["top","bottom"].

Additionally the IconButton is not really clickable once the tooltip is on top of it unfortunately.

Maybe a tooltipPosition: 'center-left' would be also cool for when the IconButton is located on the last <td> and the tooltip gets cut on the right because it goes out of the table.

A solution to the button not being clickable when the tooltip is on top of it would be to make the tooltip appear on the right and/or left of the IconButton instead of on the center. Just my 2 cents.

jpsantos7 avatar Mar 03 '17 12:03 jpsantos7

+1 on this. The closest I've gotten is

<TableRowColumn 
    onMouseEnter={()=>{this.setState({hoveredTooltip: true})}}
    onMouseLeave={()=>{this.setState({hoveredTooltip: false})}}>
        My text here
</TableRowColumn>
<Tooltip show={this.state.hoveredTooltip}
         label="My label here"
         touch={true}
/>

andrewrome avatar Jul 21 '17 22:07 andrewrome

Closing for #2230

oliviertassinari avatar Aug 22 '17 22:08 oliviertassinari

simply you can achieve this through these steps:

npm Install react-tippy then import 'react-tippy/dist/tippy.css' import { Tooltip } from 'react-tippy';

 <TableRowColumn>
     <Tooltip trigger="mouseenter" 
                   size='small' 
                  useContext html={(<p>Hidden Text</p>)}>Hover me</Tooltip>
</TableRowColumn>

more info https://github.com/tvkhoa/react-tippy

LiamBCN avatar Feb 12 '18 08:02 LiamBCN

Tooltip will be visible by adding TITLE ATTRIBUTE to the TableRowColumn as shown below: <TableRowColumn title='Text to be displayed in the Tool Tip'>Hover me</TableRowColumn> image

syedmrizwan avatar Jul 05 '18 09:07 syedmrizwan

Tooltip will be visible by adding TITLE ATTRIBUTE to the TableRowColumn as shown below: <TableRowColumn title='Text to be displayed in the Tool Tip'>Hover me</TableRowColumn> image

That's not the material-ui tooltip though...

TiagoPortfolio avatar Mar 31 '20 16:03 TiagoPortfolio

this is what I made in my project:

import Tooltip from '@material-ui/core/Tooltip'
... 
<TableCell>
    <Tooltip title={row.name} placement='right'>
        <div>{  row.name ? row.name.slice(0, 4) + '...' : ' -- ' }</div>
    </Tooltip>
</TableCell>
...

it works like using CSS but with the tooltip to show the whole text overflow: 'hidden',
textOverflow: 'ellipsis', whiteSpace: 'nowrap',

royliu007 avatar Jul 14 '20 07:07 royliu007

Adding span as a Tooltip child will works for me

 <Tooltip
     title="Hello tooltip">
         <span>Hello Tooltip</span>
  </Tooltip>

shubhamkhunt04 avatar Aug 01 '23 09:08 shubhamkhunt04