Skip to content

[Feat]: Implement render prop for custom link rendering in Menu component #309

@GaroGabrielyan

Description

@GaroGabrielyan

Component

Menu

Is your feature request related to a problem? Please describe.

Currently, the MenuItem component renders as a element internally. This prevents it from being used for client-side navigation with libraries like react-router-dom, as it causes a full page reload. This tight coupling limits the Menu component's usability, especially within other components like Navigation that rely on it for core functionality.

Describe the solution you'd like

Add a render prop to the MenuItem component to allow for custom link rendering.

  • This prop should be a function that receives one argument:

  • linkData: An object containing the item's data, like { id, title } and any other relevant props from the MenuItem.

  • The MenuItem will internally use React.cloneElement to take the element returned by the render function and automatically inject the necessary props (className, onClick, etc.) and content (Icon, text).

Here is how you would use the render prop for a simple, static link where the path is known ahead of time.

Image

Describe alternatives you've considered

No response

Are you able to assist to bring the feature to reality?

yes

Additional context

No response

Metadata

Metadata

Labels

phase / ready-to-goThis issue merged and will be included in the current milestone releasetype / featureNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions