Skip to content

Commit

Permalink
feat(docs): added tanstack router to the routing section in the docum…
Browse files Browse the repository at this point in the history
…entation (#3271)

* feat(docs): added tanstack router to the routing section in the documentation

* fix: updated the TanStack Router example by following RA example

* fix: updated the documentation wordings

* chore(docs): update highlighted row numbers

---------

Co-authored-by: HaRuki Kuriwada <[email protected]>
Co-authored-by: WK Wong <[email protected]>
  • Loading branch information
3 people authored Aug 29, 2024
1 parent 048de6e commit 56f1d68
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion apps/docs/content/docs/guide/routing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,29 @@ export default function App() {
```


### TanStack

To use [TanStack Router](https://tanstack.com/router/latest) with NextUI, render NextUI's RouterProvider inside your root route. Use `router.navigate` in the `navigate` prop, and `router.buildLocation` in the `useHref` prop.

```tsx {9,10}
// app/root.tsx
import {NextUIProvider} from '@nextui-org/react';

function RootRoute() {
let router = useRouter();

return (
<NextUIProvider
navigate={(to, options) => router.navigate({ to, ...options })}
useHref={(to) => router.buildLocation(to).href}
>
{/* You app here... */}
</NextUIProvider>
);
}
```


### Usage examples

Now that you have set up the `NextUIProvider` in your app, you can use the `href` prop in the `Tabs`,
Expand Down Expand Up @@ -245,4 +268,4 @@ function App() {
</>
);
}
```
```

0 comments on commit 56f1d68

Please sign in to comment.