Skip to main content
Version: Next

NavigationProvider

Components that render links — Sidebar, Breadcrumb, Tabs with href tabs, and Pagination with hrefTemplate — share one link contract. Wrap your app once and they all navigate through your router instead of reloading the page:

import { NavigationProvider } from '@editora/ui-react';

// React Router
const navigate = useNavigate();
<NavigationProvider navigate={(href) => navigate(href)}>…</NavigationProvider>

// Next.js (app router)
const router = useRouter();
<NavigationProvider navigate={(href) => router.push(href)}>…</NavigationProvider>

// TanStack Router
const navigate = useNavigate();
<NavigationProvider navigate={(href) => navigate({ to: href })}>…</NavigationProvider>

The links stay real <a href> elements, so Cmd/Ctrl-click, middle-click and target="_blank" open a new tab as usual; those clicks never reach the provider.

Per component​

Each of these components also takes onNavigate. It runs before the provider and can handle a link itself:

<Breadcrumb
onNavigate={(detail) => {
detail.preventDefault(); // keep the page
openInPanel(detail.href);
}}
>

navigation="client" keeps the page on every link click even without a handler (Sidebar, Breadcrumb, Tabs).

ComponentLinks come fromonNavigate detail
Sidebaritems with hrefhref, value, label, index, item
BreadcrumbBreadcrumb.Item hrefhref, label, index
TabsTabs.Tab href (use activation="manual" so arrow keys do not navigate)href, value, label, index
PaginationhrefTemplate="/expenses?page={page}"href, page, previousPage

Web components​

Without React, listen for the same cancelable navigate event on the element (event.detail.href) and call event.preventDefault() to route it yourself, or set navigation="client".