Render Breadcrumb as NavLink #34470
-
Hey, I'm using fluentUI in a react router project. I do have a Breadcrumbs Component like so: <Breadcrumb>
{matches.map(match => (
<BreadcrumbItem key={match.id}>
<BreadcrumbButton href={match.pathname}>{match.handle as string}</BreadcrumbButton>
</BreadcrumbItem>
))}
</Breadcrumb> As this renders as an <a>-Tag this does not use client side navigation but reloads the full document instead. Is there a way to use react routers NavLink component instead? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
To integrate FluentUI's import { Breadcrumb, BreadcrumbItem, BreadcrumbButton } from '@fluentui/react-components';
import { NavLink } from 'react-router-dom';
<Breadcrumb>
{matches.map(match => (
<BreadcrumbItem key={match.id}><BreadcrumbButton as={NavLink} to={match.pathname}>
{match.handle as string}
</BreadcrumbButton></BreadcrumbItem>
))}
</Breadcrumb> |
Beta Was this translation helpful? Give feedback.
I see that BreadcrumbButton doesn't not support custom component in
as
prop.You might want to try something like this:
Let me know if it helps. If no, you might want to create a feature request for Breadcrumb component.