Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to add tooltip to Header item #1263

Closed
richpixel opened this issue Oct 28, 2019 · 11 comments
Closed

Ability to add tooltip to Header item #1263

richpixel opened this issue Oct 28, 2019 · 11 comments

Comments

@richpixel
Copy link

Is it currently possible to add a tooltip to items in the header? If it isn't possible I was considering injecting a tooltip by locating the item from an id for the item, but I also don't see a way to add a specific id to the element.

Thanks

@twhetzel
Copy link

I thought there was a parameter to do this, but haven't come across it again in the docs. I did a very bulky, pure CSS implementation as:

title: <div className="tooltip">Metadata Status
<span className="tooltiptext">Validation status of the template metadata.</span></div>

And then CSS from here: https://www.w3schools.com/css/css_tooltip.asp

I'm looking to find a better way to do this.

@miktap
Copy link
Contributor

miktap commented Dec 20, 2019

Column title property type is actually string | ReactElement (documentation at the moment says it's string only) so you can also override title to use React Tooltip, e.g.:

  import { Tooltip, TableCell } from '@material-ui/core';

  const createHeaderWithTooltip = (title: string, tooltip: string) => {
    return (
      <Tooltip title={tooltip} placement='top'>
        <TableCell>{title}</TableCell>
      </Tooltip>
    );
  };

  const [columns, setColumns] = React.useState<Array<Column<Data>>>([
    { title: createHeaderWithTooltip('Name', 'Name of the data'), field: 'name' },
  ]);

@miktap
Copy link
Contributor

miktap commented Dec 20, 2019

Setting ReactElement as a title does have drawbacks. The title is for example used as a placeholder property for a textfield or currency field when adding/editing a field. And the placeholder property only supports strings.

@jakeleventhal
Copy link

Something similar to this could look good
Screen Shot 2019-12-25 at 11 17 09 AM

@mbrn mbrn closed this as completed in d2be63b Jan 16, 2020
@jakeleventhal
Copy link

The tooltip appears to show up in the middle of the table here? I think something may be wrong. Can we reopen this
Screen Shot 2020-01-25 at 3 36 28 PM

@mbrn mbrn reopened this Jan 26, 2020
@mbrn
Copy link
Owner

mbrn commented Jan 26, 2020

Hi @jakeleventhal ,

I will take a look again.

@jakeleventhal
Copy link

Also, there should be some sort of indication that the header has a tooltip. Right now, it is not clear until it appears

@stale
Copy link

stale bot commented Jul 5, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.

@stale stale bot added the wontfix This will not be worked on label Jul 5, 2020
@jakeleventhal
Copy link

not stale @mbrn

@stale stale bot removed the wontfix This will not be worked on label Jul 5, 2020
@mbrn
Copy link
Owner

mbrn commented Aug 16, 2020

Problem solved with 1.68.1

@aguessous
Copy link

aguessous commented Jan 25, 2022

hi
const getTooltip= () => {
return div Hello world /div";

const [columns, setColumns] = useState<any[]>([
{ title: 'my title', field: 'name', tooltip: getTooltip() },
]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants