Open manelmadeira opened 2 months ago
We have similar issues with Next JS apps and next/link
.
We are going to provisionally pull this into our next sprint, at least for discussion and decide on the final approach.
We have similar issues with Next JS apps and
next/link
. We are going to provisionally pull this into our next sprint, at least for discussion and decide on the final approach.
I'd imagine that the approach used for this would be the same for the Lab's BreadcrumbItem
component, right?
Area
UI Components
The problem
We are using
@tanstack/react-router
to manage our app's routing and we want to be able to use Salt'sNavigationItem
with theirLink
attributes.They export a hook
useLinkProps
(docs) that allows us to send all the navigation related props to a custom anchor tag.We tried using it with
NavigationItem
like thisbut that's not enough for
@tanstack/react-router
to navigate to the new route. After looking into their hook's source code, I realised we need to pass more than justhref
to the anchor tag for routing to work.The solution
Is it possible to add an additional prop to
NavigationItem
to allow this (eg.linkProps
)?This would allow to do something like:
Alternatives and examples
Alternative we could allow passing a
ReactElement
to replace the anchor element rendered byNavigationItem
and add styling to it.Chakra UI allows to pass other elements to be rendered instead using an
as
property. https://v2.chakra-ui.com/community/recipes/as-propAre you a JPMorgan Chase & Co. employee?