Components: reconcile ItemGroup
/Item
with MenuGroup
/MenuItem
#35210
Labels
[Feature] Component System
WordPress component system
[Package] Components
/packages/components
[Type] Task
Issues or PRs that have been broken down into an individual action to take
What
This conversation was started in #35142 (comment)
We should look into refactoring
MenuGroup
andMenuItem
to rely on the lower levelItemGroup
andItem
. This would enable the usage ofMenuGroup
andMenuItem
outside ofDropdownMenu
and would give us a chance to enforce a more consistent look&feel (including spacing) across menu layouts.Why
The
MenuGroup
andMenuItem
components were created as high-level components, tailored to be used inside theDropdownMenu
component. As such, they are quite opinionated in terms of:MenuItem
renders (which is always aButton
)MenuItem
DropdownMenu
is supposed to haverole="menu"
,MenuGroup
would haverole="group"
andMenuItem
therole="menuitem"
)On the other hand, the recently introduced
ItemGroup
andItem
components offer a more low-level approach, are much less opinionated and rely on composition with other components. Their low-level approach can require a lot of tweaking when used directly in complex UIs, and therefore can easily lead to inconsistencies when used in different parts of the editor.That's why we should look into uniforming the look&feel of menus across different UI patterns (dropdown menus, navigation menus, modal menus, sidebar menus...) and consider rewriting
MenuGroup
andMenuItem
usingItemGroup
andItem
, with the intention of unlocking their usage in more situations outside ofDropdownMenu
.A/C
ItemGroup
/Item
andMenuGroup
/MenuItem
, matching the spacing of other existing components (e.g. aligning with the icons in theModal
component).MenuGroup
andMenuItem
to TypeScript, switch to the new styling system, and hook to the Context SystemMenuGroup
andMenuItem
to use internallyItemGroup
andItem
and expose more flexibilityThe text was updated successfully, but these errors were encountered: