-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request]: Support Routing in BreadcrumbGroup #3282
Comments
Hello! Integration with React router is expected this way const navigate = useNavigate();
<BreadcrumbGroup onFollow={event => navigate(event.detail.href)}> Longer explanation of reasons why we do not allow can be found in another issue: #126 (comment)
Can you elaborate on this? This code |
This simple app demonstrates the issue.
Navigating to http://localhost:3000/some-basename
Ideally there would be some mechanism to have all of them include the basename. |
If you use |
Description
The goal of this change is to provide compatibility between BreadcrumbGroup and routers.
Currently
BreadcrumbGroupProps.Item
accepts only a stringhref
, and theBreadcrumbGroup
component accepts a list of these items as input.When using React Router (or other react router library), resolved href values are available through hooks or components (like
useHref
andLink
for React Router).While
BreadcrumbGroupProps
exposesonFollow
andonClick
events that can be used to correctly navigate with a router, this will not extend to the href of the generated<a>
tag, and therefore will not apply to hovering over links, copying links, or opening links in a new tab/window.Because the
items
value is an array, there isn't a way to use hooks or components to generate the correct set ofhref
values.Instead, the
BreadcrumbGroup
component should allow items to be defined themselves as components.Potential solutions
Expose the BreadcrumbItem component.
Modify the
items
input type ofBreadcrumbGroup
to be the union ofextends BreadcrumbGroupProps.Item
andextends BreadcrumbItem
.This will allow users to create their own custom component for
BreadcrumbItem
, and therefore have the ability to use React Router hooks to render the exacthref
value.Code of Conduct
The text was updated successfully, but these errors were encountered: