Skip to content

MenuItem — composition over configuration #96202

Open
4 of 8 issues completed
Open

Description

@melvin-bot

Problem

The MenuItem component has ~130 props. We're actively decomposing large components like this, so it's a perfect candidate — e.g. 10+ icon-related props, plus tooltip logic, both extractable once it follows composition. It's the same compound pattern we already use for Button and Table.

Proposed Solution

Adopt a compound component pattern with a granular interface (flexibility for complicated cases) and a few presets covering the majority of the app.

Proposed API

<MenuItem.Root>
    <MenuItem.Label />
    <MenuItem.Row>
        <MenuItem.Icon />
        <MenuItem.Content>
            <MenuItem.Description />
            <MenuItem.Title />
        </MenuItem.Content>
        <MenuItem.Trailing>
            <MenuItem.Badge />
            <MenuItem.BrickRoadIndicator />
            <MenuItem.Chevron />
        </MenuItem.Trailing>
    </MenuItem.Row>
    <MenuItem.Error />
    <MenuItem.Hint />
</MenuItem.Root>

Presets

  • Extract MenuItemStandard (name TBD)
  • Update existing MenuItemWithTopDescription
  • These two presets should cover 80%+ of use cases; the rest will get dedicated presets or use the refactored MenuItem directly

Backwards compatibility

  • The existing <MenuItem title icon … /> API stays as-is — nothing breaks
  • Migration is incremental by deprecating the old component

Benefits

  • Stops new props being added every time a part of the item needs customising
  • Reduces rerenders across the app
  • Improves maintainability
  • Removes dead features (e.g. shouldPutLeftPaddingWhenNoIcon)

Sub-issues

Sub-issues

4 of 8 Issues completed
Loading 8 sub-issues

Activity

  1. melvin-bot commented on Jul 15, 2026

    @melvin-bot
    Author

    This issue is not open for proposals — war-in will be working on it directly.

  2. war-in commented on Jul 17, 2026

    @war-in
    Contributor

    I'm diving into the MenuItem implementation to understand it in detail. I've already removed some dead code and unused props. The next step is to define subcomponents and create a dev gallery of all variants so the old and new versions can be easily compared.

  3. war-in commented on Jul 20, 2026

    @war-in
    Contributor

    I managed to cover most of the MenuItem variants; TODOs

    • compact variant
    • secondary icon fill

    I also contacted Shawn to consult on some designs and got access to figma. Looks like the current MenuItem is not aligned with it, so I'll make sure the new version follows the designs properly.

    The MenuItem comparison gallery looks promising and I expect the draft PR to be submitted later this week

    Image
  4. war-in commented on Jul 21, 2026

    @war-in
    Contributor

    I opened a draft PR for an internal review (SWM) and triggered a Codex review. I'll open the PR once it passes review from SWM team

  5. war-in commented on Jul 23, 2026

    @war-in
    Contributor

    FYI, I received a review from SWM team and now I'm going through it

  6. war-in commented on Jul 28, 2026

    @war-in
    Contributor

    I addressed most of the comments. Now the decomposition pattern is confirmed, and I'm working on splitting the PR into smaller parts. It should improve its readability, and we shouldn't introduce any unused props

  7. roryabraham commented on Jul 30, 2026

    @roryabraham
    Contributor

    Thanks for taking the time to break the PR up into smaller PRs. It's helpful also to clarify the high level rollout plan of the series of PRs you have planned. So once you figure that out, feel free to leave a comment here before I dive into the first PR review

  8. 125 remaining items

  9. melvin-bot commented on Nov 2, 2026

    @melvin-bot
    Author

    @Pujan92, @roryabraham, @war-in Whoops! This issue is 2 days overdue. Let's get this updated quick!

  10. roryabraham commented on Nov 3, 2026

    @roryabraham
    Contributor

    @MelvinBot post a status update on this and on all open sub-issues

  11. MelvinBot commented on Nov 3, 2026

    @MelvinBot
    Contributor

    Status: ~84% of rows use the new API, and no PR is in flight

    One PR merged since the last update: `MenuItem` decomposition - wrapperStyle-only `MenuItemWithTopDescription` rows. It moved 7 Phase 3 rows to MenuItemField. It is waiting for the next production release to reach staging.

    `MenuItem` decomposition - migratable batch reached production on Nov 2 in 9.5.27-2.

    Where the migration stands

    Oct 30 (0c5a23e) Now (d138eba)
    Legacy MenuItemWithTopDescription 73 66
    Legacy direct MenuItem 52 49
    Legacy total 125 115

    The 3 direct MenuItem rows were not migrated. Unrelated PRs deleted their files (PolicyAccountingPage, WorkspaceMCPPage, MergeProviderCard).

    Sub-issues

    Sub-issue State
    MenuItem decomposition Phase 3 — MenuItemWithTopDescription replacement preset 🟢 Weekly, Reviewing. 66 sites left
    MenuItem decomposition Phase 4 — style-prop remnants 🟡 Daily, Overdue. 49 sites left. Regression period ends Nov 9
    MenuItem decomposition Phase 5 — shared wrapper components ⚪ Weekly. Not started
    MenuItem decomposition Phase 6 — long-tail cleanup ⚪ Weekly. Not started

    Needs action

    1. war-in or Pujan92: open the next batch. Nothing is in review.
    2. roryabraham: confirm the Phase 3 / Phase 6 split. Phase 3 sends its 25 rows with 10+ props to Phase 6. No one has replied yet.
    3. Switch this issue and Phase 4 to Weekly. Both are still Daily, which drives the overdue pings.

    I posted a status update on each open sub-issue: Phase 3, Phase 4, Phase 5, Phase 6.

    Counts are JSX opening tags in src/, excluding Storybook and MenuItem internals. This is the same method as the last update.


    view run

  12. melvin-bot commented on Nov 3, 2026

    @melvin-bot
    Author

    @Pujan92, @roryabraham, @war-in Whoops! This issue is 2 days overdue. Let's get this updated quick!

  13. added
    Reviewing
    Weekly
    and removed
    Daily
    on Nov 3, 2026
  14. roryabraham commented on Nov 3, 2026

    @roryabraham
    Contributor

    Created six more PRs for this migration:

  15. Pujan92 commented on Nov 15, 2026

    @Pujan92
    Contributor

    @MelvinBot post a status update on this and on all open sub-issues

  16. MelvinBot commented on Nov 15, 2026

    @MelvinBot
    Contributor

    Status — Nov 15: 14 migration PRs merged since Nov 3; one remains open

    The migration has progressed substantially, but remaining code work means the project is not ready to close.

    I posted targeted updates on all four open sub-issues:

    Sub-issue Current status
    Phase 3 — top-description replacement Nine additional PRs merged. No linked PR currently open. Wallet changes reached production Nov 13; regression window runs through Nov 20.
    Phase 4 — style-prop remnants Keyboard shortcuts and GL code/2FA/accounting batches merged. The latter reached production Nov 13; regression window runs through Nov 20.
    Phase 5 — shared wrappers roryabraham reported progress Nov 11, but no PR references this tracker yet.
    Phase 6 — long-tail cleanup Three PRs merged; three top-description rows remain open.

    Immediate next steps

    1. Clear independent approval on the remaining PR. Pujan92 approved it today; the latest reviewer checklist and technical checks pass. It is conflict-free, but Check independent approval still fails and merging remains blocked.
    2. Link the Phase 5 work so its scope and blockers are visible.
    3. Refresh the remaining-call-site inventory before choosing further batches. Earlier percentages and counts are stale; I have not presented them as current.

    The remaining PR’s web verification was blocked by bank-setup email verification, so several row-level checks remain unverified—not confirmed product failures.


    view run

  17. Pujan92 commented on Nov 20, 2026

    @Pujan92
    Contributor

    @MelvinBot open a cleanup PR for the legacy MenuItem (src/components/MenuItem/MenuItem.tsx, #105531): remove these props, which no caller uses any more, together with the code that only they reach: shouldParseTitle, excludedMarkdownRules, shouldParseHelperText, helperTextStyle, shouldRenderErrorAsHTML, titleWithTooltips, shouldTruncateTitle, shouldShowBadgeBelow, shouldShowBadgeInSeparateRow, furtherDetailsNumberOfLines, furtherDetailsStyle, iconAccountID, iconReportID, shouldPutLeftPaddingWhenNoIcon, furtherDetails, furtherDetailsIcon, furtherDetailsComponent. Before removing each one, confirm with a repo-wide search (including object keys in MenuItemProps-typed configs and spreads) that nothing passes it. Remove the MenuItemComparison story cases that use iconAccountID/iconReportID/titleWithTooltips and the shouldPutLeftPaddingWhenNoIcon line in PopoverMenuV2.stories.tsx, and reword the shouldParseTitle mention in tests/unit/ParserTest.ts. No behaviour change for remaining callers. Run typecheck and the MenuItem tests.

    Mark it ready for review

  18. MelvinBot commented on Nov 20, 2026

    @MelvinBot
    Contributor

    🤖 Web test steps verification results: ❌ fail

    Opened Remove unused legacy MenuItem props and unreachable branches, ready for review, assigned to Pujan92; repo-wide caller audit, typecheck, and 470 targeted tests passed. Full Jest timed out; browser verification was blocked by a suspended, empty session—not a confirmed product failure.

    Page where story verification was blocked

    Step Status
    MenuItemComparison renderingTitles, descriptions, badges, helpers/errors, and right-side avatars could not be verified.
    Page where story verification was blocked
    ❌
    Click, disabled, and copy behaviorNot verified: story rows were inaccessible.
    ❌
    PopoverMenuV2 rendering and interactionsNot verified: story rows were inaccessible.
    ❌

    view run · no recording available

  19. removed
    Reviewing
    on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions