Add Tooltip component - #547
Conversation
🦋 Changeset detectedLatest commit: 66059ff The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🟢 No design token changes found |
|
|
@mperrotti a few questions for ya:
|
We don't strictly need those additional options, but I think it's nice to have them as options. If you and other designers want to limit the options, we can remove them.
This is possible, but I'd rather not do this. I don't see what we'd gain by doing this, and I like that the tooltip is sized to "shrink-wrap" its content. I'm also concerned about having a noticeable performance hit on pages with many tooltips. Whenever you measure a DOM node, the browser needs to perform a reflow.
Yes. We used to have that triangle in |
|
@mperrotti Thank you for your answers, that all make sense. I like the minimalism and flexibility of this new version. |
|
@mperrotti following up here this as I brought this the the broader team for review. We have review and decided that the proposed component is too small for marketing contexts. We'd like the see a revised version including:
|
|
@nsolerieu - the screen recording is out of date, so the tooltip is actually larger. So the only updates will be:
I'll ping you when it's ready for another review. |
Maybe capture it on a tasklist on the tracking issue? We usually add it to the same PR, but if you need to add it in follow-up PR that's fine too 👍. Btw, I'm referring to the React component docs, not the interface guidelines. |
|
Ahh the React docs. Yes I can add those here. |
|
@rezrah - I added React docs, but I'm getting this error: Can you confirm that I'm doing my exports from Also, I'm having trouble running Gatsby locally to test my docs locally, so it's hard to debug. |
| ```jsx live | ||
| <Tooltip text="Go fullscreen" type="label"> | ||
| <Button hasArrow={false}><ScreenFullIcon /></Button> | ||
| </Tooltip> | ||
| ``` |
rezrah
left a comment
There was a problem hiding this comment.
🙌 Nice one @mperrotti, this looks great.
Just some minor, additional feedback around docs but otherwise LGTM 👍 ![]()
Co-authored-by: Rez <13340707+rezrah@users.noreply.github.com>





Closes https://github.com/github/primer/issues/3060
Summary
Adds a Tooltip component for showing contextual information when focusing or hovering interactive elements. I made the decision to remove the caret shown in the screenshot in the issue's description. Other Primer designers were happy with this, and it's the same style we use in
@primer/react's new Tooltip.List of notable changes:
added Tooltip component
What should reviewers focus on?
Confirm that the Tooltip looks and behaves as expected.
Steps to test:
Contributor checklist:
Reviewer checklist:
Screenshots:
N/A
Rewatch.Screen.Recording.-.2024-03-01.at.7.10.mp4