Summary
Add a codemod that replaces MUI Tooltip usage with the BUI TooltipTrigger + Tooltip pattern for the common single-child wrapper cases.
The codemod should stay deterministic: rewrite the straightforward wrapper structure and leave TODO markers for controlled or unusually nested tooltip implementations.
Detection Criteria
Tooltip imports from @material-ui/core/Tooltip
title, placement, open, onClose, and leaveDelay props on those tooltips
- a single JSX child wrapped by the tooltip
Transformation Logic
- Replace the MUI import with
TooltipTrigger and Tooltip from @backstage/ui.
- Rewrite the simple wrapper shape so the original tooltip child becomes the first child of
TooltipTrigger and the tooltip content becomes the BUI Tooltip child.
- Move the MUI
title content into the BUI Tooltip body.
- Preserve simple controlled-open patterns only when they can be mapped mechanically to
isOpen / onOpenChange on TooltipTrigger.
- If the wrapper structure is not a single local child or the open-state logic is nontrivial, leave
TODO(backstage-codemod): finish tooltip migration manually.
Before / After Example
Simple tooltip wrapper:
// Before
import Tooltip from '@material-ui/core/Tooltip';
<Tooltip title="More actions">
<IconButton aria-label="more">
<MoreVertIcon />
</IconButton>
</Tooltip>
// After
import { Tooltip, TooltipTrigger } from '@backstage/ui';
<TooltipTrigger>
<IconButton aria-label="more">
<MoreVertIcon />
</IconButton>
<Tooltip>More actions</Tooltip>
</TooltipTrigger>
Notes / Edge Cases
- Placement-only props can be preserved only if the BUI tooltip supports the same value directly; otherwise leave a TODO marker.
- Tooltip migration should commute with both the
IconButton and icon-source codemods.
- Do not try to auto-wrap multiple children or fragments in synthetic spans without a clear prior-art rule.
- Representative Backstage migrations include
CopyTextButton and notification actions.
Changeset (when implementing)
- Package:
@backstage/migrate-mui-tooltip-to-bui-tooltip
- Bump: minor (initial release)
- Summary example:
Add codemod to migrate mui tooltip to bui tooltip for the Backstage MUI 4 to BUI migration
Implementation notes
- Target directory:
codemods/misc/migrate-mui-tooltip-to-bui-tooltip/
- Branch/worktree:
.worktrees/feat/mui4-to-bui/migrate-mui-tooltip-to-bui-tooltip
- Open PR when ready; one PR per codemod
Summary
Add a codemod that replaces MUI
Tooltipusage with the BUITooltipTrigger+Tooltippattern for the common single-child wrapper cases.The codemod should stay deterministic: rewrite the straightforward wrapper structure and leave TODO markers for controlled or unusually nested tooltip implementations.
Detection Criteria
Tooltipimports from@material-ui/core/Tooltiptitle,placement,open,onClose, andleaveDelayprops on those tooltipsTransformation Logic
TooltipTriggerandTooltipfrom@backstage/ui.TooltipTriggerand the tooltip content becomes the BUITooltipchild.titlecontent into the BUITooltipbody.isOpen/onOpenChangeonTooltipTrigger.TODO(backstage-codemod): finish tooltip migration manually.Before / After Example
Simple tooltip wrapper:
Notes / Edge Cases
IconButtonand icon-source codemods.CopyTextButtonand notification actions.Changeset (when implementing)
@backstage/migrate-mui-tooltip-to-bui-tooltipAdd codemod to migrate mui tooltip to bui tooltip for the Backstage MUI 4 to BUI migrationImplementation notes
codemods/misc/migrate-mui-tooltip-to-bui-tooltip/.worktrees/feat/mui4-to-bui/migrate-mui-tooltip-to-bui-tooltip