# Route to pages in plugin

**URL:** https://discuss.elastic.co/t/route-to-pages-in-plugin/334581
**Category:** Kibana
**Tags:** kibana-plugin-development
**Created:** [May 29, 2023, 11:37am UTC](https://discuss.elastic.co/t/route-to-pages-in-plugin/334581 "2023-05-29T11:37:39Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Sheereen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sheereen/32/122005_2.png) [@Sheereen](https://discuss.elastic.co/u/Sheereen)
#### Post date: [May 29, 2023, 11:37am UTC](https://discuss.elastic.co/t/route-to-pages-in-plugin/334581/1 "2023-05-29T11:37:39Z")

</div>

Hi,

I am creating an external plugin in React.  
How can i implement routes in plugin? Like giving path for different components/pages.  
Is there any inbuilt way of doing the same in Kibana?... like there is for toast, http routes, ...

I would like to combine the same with Breadcrumbs thereafter.

Thanks,  
Sheereen

---

<div class="post-metadata">

### Author: ![Sheereen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sheereen/32/122005_2.png) [@Sheereen](https://discuss.elastic.co/u/Sheereen)
#### Post date: [June 5, 2023, 7:30am UTC](https://discuss.elastic.co/t/route-to-pages-in-plugin/334581/2 "2023-06-05T07:30:21Z")

</div>

Hello

Can someone please help me on this?

---

<div class="post-metadata">

### Author: ![ppisljar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppisljar/32/11588_2.png) [@ppisljar](https://discuss.elastic.co/u/ppisljar)
#### Post date: [June 5, 2023, 2:22pm UTC](https://discuss.elastic.co/t/route-to-pages-in-plugin/334581/3 "2023-06-05T14:22:00Z")

</div>

take a look at some of build in plugins on how they do that

this might be a good example:

> <https://github.com/elastic/kibana/blob/main/src/plugins/unified_search/server/autocomplete/value_suggestions_route.ts>

(this is the route, check how its created and how the plugin registers it)

---

<div class="post-metadata">

### Author: ![Sheereen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sheereen/32/122005_2.png) [@Sheereen](https://discuss.elastic.co/u/Sheereen)
#### Post date: [June 6, 2023, 6:29am UTC](https://discuss.elastic.co/t/route-to-pages-in-plugin/334581/4 "2023-06-06T06:29:01Z")

</div>

This is http routing in server side for api calls

I am talking about navigating between ui pages

I saw in many places, they are using Route from @kbn/shared-ux-router, which is not being included in package.json of new releases of Kibana.

So how should I go about this. Found links over here ([Routing, Navigation and URL | Kibana Guide [8.8] | Elastic](https://www.elastic.co/guide/en/kibana/current/kibana-navigation.html#routing)). But except for one, none works.

---

<div class="post-metadata">

### Author: ![ppisljar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppisljar/32/11588_2.png) [@ppisljar](https://discuss.elastic.co/u/ppisljar)
#### Post date: [June 6, 2023, 11:02am UTC](https://discuss.elastic.co/t/route-to-pages-in-plugin/334581/5 "2023-06-06T11:02:06Z")

</div>

those docs might be outdated, i suggest you to check the code, maybe this example plugin can be helpful: [kibana/plugin.tsx at main · elastic/kibana · GitHub](https://github.com/elastic/kibana/blob/main/examples/routing_example/public/plugin.tsx)

---

<div class="post-metadata">

### Author: ![Sheereen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sheereen/32/122005_2.png) [@Sheereen](https://discuss.elastic.co/u/Sheereen)
#### Post date: [June 6, 2023, 12:54pm UTC](https://discuss.elastic.co/t/route-to-pages-in-plugin/334581/6 "2023-06-06T12:54:01Z")

</div>

Thanks for the resource.

But as I said before, the above doc/example is for http routing.... meaning api calls from public-\>server-\>backend

What I am looking for is navigation. Navigating from 1 page to another and adding breadcrumbs in the process.

---

<div class="post-metadata">

### Author: ![ppisljar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppisljar/32/11588_2.png) [@ppisljar](https://discuss.elastic.co/u/ppisljar)
#### Post date: [June 7, 2023, 9:40am UTC](https://discuss.elastic.co/t/route-to-pages-in-plugin/334581/7 "2023-06-07T09:40:14Z")

</div>

the above example (and a lot of other plugins) contain the client side routing part as well

---

<div class="post-metadata">

### Author: ![Sheereen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sheereen/32/122005_2.png) [@Sheereen](https://discuss.elastic.co/u/Sheereen)
#### Post date: [June 9, 2023, 8:41am UTC](https://discuss.elastic.co/t/route-to-pages-in-plugin/334581/8 "2023-06-09T08:41:54Z")

</div>

I tried using React router.

I am using React router - 6.12

```auto
 <BrowserRouter>
    <Routes>
       <Route path="/" element={<HomePage />} />
       <Route path="/profile" element={<Profile/>} />
 </BrowserRouter>

```

And then used to access the Profile tab.

But it doesn't work... gives the following error:  
**Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.**

Moreover, in documentation ([Routing, Navigation and URL | Kibana Guide [8.8] | Elastic](https://www.elastic.co/guide/en/kibana/current/kibana-navigation.html#routing)) I saw we have to use history provided by core. But v6 of react-router doesn't have history.

The example you shared is not related to navigation between pages. I did not find n example for navigation, except for this ([kibana/application.tsx at 8.8 · elastic/kibana · GitHub](https://github.com/elastic/kibana/blob/8.8/test/plugin_functional/plugins/core_plugin_a/public/application.tsx#L120)), which used old version of react-router (v4)

And in the examples I could fine, Route was being imported from '@kbn/shared-ux-router' ([kibana/application.tsx at 8.8 · elastic/kibana · GitHub](https://github.com/elastic/kibana/blob/8.8/test/plugin_functional/plugins/core_plugin_a/public/application.tsx#L13)) .

```auto
import { Route } from '@kbn/shared-ux-router';

```

@kbn/shared-ux-router, is not there in package.json of Kibana. I am using version 8.5.3

---

<div class="post-metadata">

### Author: ![Sheereen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sheereen/32/122005_2.png) [@Sheereen](https://discuss.elastic.co/u/Sheereen)
#### Post date: [June 9, 2023, 10:45am UTC](https://discuss.elastic.co/t/route-to-pages-in-plugin/334581/9 "2023-06-09T10:45:37Z")

</div>

> [@Sheereen](#):
>
> `@kbn/shared-ux-router`

Can I manually add this package?  
@kbn/shared-ux-router

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 7, 2023, 10:46am UTC](https://discuss.elastic.co/t/route-to-pages-in-plugin/334581/10 "2023-07-07T10:46:25Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
