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)
Issue Owner
Current Issue Owner: @Pujan92
Problem
The
MenuItemcomponent 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 forButtonandTable.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
Presets
MenuItemStandard(name TBD)MenuItemWithTopDescriptionMenuItemdirectlyBackwards compatibility
<MenuItem title icon … />API stays as-is — nothing breaksBenefits
shouldPutLeftPaddingWhenNoIcon)Issue Owner
Current Issue Owner: @Pujan92