Skip to content

Conversation

@aqandrew
Copy link
Contributor

@aqandrew aqandrew commented Nov 20, 2025

for #19974

Redo of #20027, this time splitting it into multiple PRs + using our existing Tooltip component instead of creating a new component (see below). This PR covers the most basic usage of the MUI Tooltip, i.e., the tooltip content is a string literal.

Adds a global TooltipProvider to AppProviders and our Storybook decorators, so that we don't have to render a TooltipProvider for every tooltip instance. Removing redundant TooltipProviders will be another separate PR <- this was done by #20869

@aqandrew aqandrew changed the title Replace mui tooltip with minitooltip refactor: replace MUI Tooltip component with MiniTooltip Nov 20, 2025
@aqandrew
Copy link
Contributor Author

I originally felt it was necessary to create a new component, MiniTooltip, to be a drop-in replacement for @mui/material/Tooltip, since it's more opinionated about styles. But while writing MiniTooltip.stories.tsx, I noticed how similar it is to our existing tooltip component. Now I'm torn:

MiniTooltip's main differences from Tooltip

  • 0 delay before appearing (same as MUI tooltip)
  • max width of 300px
  • includes option to add Radix's Tooltip.Arrow

reasons to keep MiniTooltip

  • don't want to introduce a tooltip delay to users where there wasn't one previously
    • the pro-Tooltip solution to this is to just set delayDuration={0} on all of the MUI tooltips being replaced

reasons to just use Tooltip instead

  • encouraging devs to use a single component / mental model for this purpose creates a more consistent DX
    • don't want to introduce friction during development: "Should this tooltip be a Tooltip or a MiniTooltip?"
  • these MUI tooltips usually contain short text, which isn't enough to hit the 300px max width
  • tooltip arrow is only used in one place (TemplateInsightsPage), so we can add Tooltip.Arrow there as a one-off

...Actually I'm not so torn now that I've written the above. The existing Tooltip is looking like the winner to me, so I'll have some further changes to make to this PR.

@aqandrew aqandrew changed the title refactor: replace MUI Tooltip component with MiniTooltip refactor: replace MUI Tooltip component with Tooltip (simple usage) Nov 22, 2025
@aqandrew aqandrew marked this pull request as ready for review November 22, 2025 01:59
@aqandrew aqandrew requested review from aslilac and jaaydenh November 22, 2025 01:59
@aqandrew aqandrew marked this pull request as draft November 24, 2025 23:46
@aqandrew aqandrew marked this pull request as ready for review November 25, 2025 00:22
@aqandrew
Copy link
Contributor Author

Updated this PR to include #20869 from main. Thanks @jaaydenh!

@aqandrew aqandrew requested a review from jaaydenh November 25, 2025 18:19
Copy link
Member

@aslilac aslilac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked a few of the tooltips, and the code looks good!

@aqandrew aqandrew merged commit 4863812 into main Nov 25, 2025
31 checks passed
@aqandrew aqandrew deleted the replace-mui-tooltip-with-minitooltip branch November 25, 2025 21:40
@github-actions github-actions bot locked and limited conversation to collaborators Nov 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants