Repository navigation
Conversation
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. As a user I want to be able to create a navigation overlay for a specific navigation block in
|
There was a problem hiding this comment.
🟡 Changes recommended
The migration guide omits icon conversions needed to prevent rendering errors, recommends inaccessible tooltips for additional information, and incorrectly states that custom icon sizing has no replacement.
3 open issues
What changed in this PR
Adds a Storybook guide for migrating legacy Button usage to @wordpress/ui ahead of stabilization.
Changes:
- Maps legacy props and behaviors to replacement components, with examples.
- Documents accessibility and styling differences without changing implementations or recommendation status.
| File | Description |
|---|---|
packages/components/src/button/stories/migration-guide.mdx |
Adds Button migration guidance and before-and-after examples. |
Review effort: Balanced
|
|
||
| ### Icon with text | ||
|
|
||
| Replace the `icon` prop with a `Button.Icon` child. To show the icon after the text, put `Button.Icon` after the text. This replaces `iconPosition="right"`. |
| `Button` has no `showTooltip` prop. A visible text label usually makes a tooltip unnecessary. If the tooltip gives more information, compose `Button` with `Tooltip`: | ||
|
|
||
| ```jsx | ||
| import { Button, Tooltip } from '@wordpress/ui'; | ||
|
|
||
| <Tooltip.Root> | ||
| <Tooltip.Trigger render={ <Button variant="outline" /> }> | ||
| Preview | ||
| </Tooltip.Trigger> | ||
| <Tooltip.Popup>Preview in a new tab</Tooltip.Popup> |
| </Button>; | ||
| ``` | ||
|
|
||
| `Button.Icon` always uses the same icon size. There is no replacement for `iconSize`. |


What?
Adds a "Migration Guide" for migrating from
@wordpress/component'sButtonto@wordpress/uiequivalents.Addresses #76135 (comment)
Why?
In preparation for stabilizing
@wordpress/ui'sButton, having a migration guide will help consumers of the existing@wordpress/componentsButtonadapt their code to use the new component.Migration guides are mentioned as part of the process for replacing a legacy component. This follows precedent for several other component migration guides that already exist (example).
Since
Buttonis one of the most commonly-used components, and the newButtoncomponent abstractions are significantly different than how they existed previously, it's particularly important that we provide clear guidance on how to adapt existing code to use the new components.How?
This only adds the migration guide content. It doesn't change anything about either implementation's stability or recommendation. As there is no prior art for implementing a migration guide before a component's stabilization, the text includes a note that the new components "are not yet recommended for use alongside components from
@wordpress/components", and this note should be removed when the new components are stabilized.Testing Instructions
npm run storybook:devlocally@wordpress/components> Actions > Button > Migration GuideUse of AI Tools
Implemented in coordination with Claude Code + Opus 5.5, with iterations based on my own review feedback and using contextual information from previous discussions about particular decisions:
Button#74415, UI: Add AlertDialog primitive #76847LinkButton,IconLinkButtoncomponents #77098