Skip to content
On this page

useNavigation

Definition

Composable for navigation. Provides state for navigation trees depending on navigation type.

Basic usage

ts
const {  navigationElements, loadNavigationElements } = useNavigation(params);

Signature

ts
export function useNavigation(params?: {
  type?: StoreNavigationType;
}): UseNavigationReturn 

Parameters

NameTypeDescription
params
{
  type?: StoreNavigationType;
}

Return type

See UseNavigationReturn
ts
export type UseNavigationReturn = {
  /**
   * List of navigation elements
   */
  navigationElements: ComputedRef<StoreNavigationElement[] | null>;
  /**
   * Load navigation elements
   */
  loadNavigationElements(params: {
    depth: number;
  }): Promise<StoreNavigationElement[]>;
};

Properties

NameTypeDescription
navigationElements
ComputedRef<Array<StoreNavigationElement> | null>
List of navigation elements

Methods

NameTypeDescription
loadNavigationElements
Promise<Array<StoreNavigationElement>>
Load navigation elements
useNavigation has loaded