nutgaard / react-router-breadcrumbs

Breadcrumb component for react-router
Other
46 stars 11 forks source link

Question: Different Breadcrumb #281

Closed talon-himself closed 7 years ago

talon-himself commented 7 years ago

Is it possible to have a dropdown/select input appear as a breadcrumb rather than text?

nutgaard commented 7 years ago

Hi, yeah it should be possible.

The Breadcrumb-component has a createLink-prop which you can use to override how the crumbs are rendered. Here you could return a select instead, though you must handle the redirect when the values changes by yourself.

talon-himself commented 7 years ago

@nutgaard Thanks for the quick response. Another question....is there a way to specify which crumb? I see that routes is a param, but this will make all routes a dropdown rather than just the current or last one.

nutgaard commented 7 years ago

I'm not really sure I'm following what you trying to do here.

But the expected type of createLink is (link, key, text, index, routes) => React.Element; So you could use index and routes.length to create a select on only the last crumb.

talon-himself commented 7 years ago

That is precisely what I need...A certain route to display a dropdown/select in the breadcrumb rather than a Link. Thank you.