Skip to content
+

useNavigation

Toolpad Core exposes an API to access the current navigation definition.

Usage

When a navigation is set in Toolpad Core, a NavigationContext is used to share navigation information among all Toolpad Core components, with the value from the navigation prop of the AppProvider:

<AppProvider navigation={navigation}>{props.children}</AppProvider>

You can access the current value of the NavigationContext by invoking the hook inside your components:

import { useNavigation } from '@toolpad/core/useNavigation';

function MyComponent() {
  // ...
  const navigation = useNavigation();
  // ...
}

Hook API