UNPKG

react-navplus

Version:

A flexible, performance-optimized navigation link component for React with multi-router support, prefetching, and advanced active state detection

63 lines 1.67 kB
import React from 'react'; import { NavLinkContextValue, PrefetchOptions, MatchMode } from '../types'; /** * Context for sharing navigation state across components */ export declare const NavLinkContext: React.Context<NavLinkContextValue>; /** * Props for the NavLinkProvider component */ interface NavLinkProviderProps { /** * Children to render inside the provider */ children: React.ReactNode; /** * Optional map of active state matcher functions */ activeMatchers?: Map<MatchMode, (pathname: string, url: string, pattern?: RegExp) => boolean>; /** * Default prefetch options to use for all links */ prefetchDefaults?: PrefetchOptions; /** * Custom router context if not using React Router */ customRouterContext?: any; /** * Whether to use React Router context automatically * @default true */ useReactRouterContext?: boolean; } /** * Provider component for NavLinkContext * * @component * @example * // Basic usage * <NavLinkProvider> * <App /> * </NavLinkProvider> * * @example * // With custom prefetch defaults * <NavLinkProvider * prefetchDefaults={{ enabled: true, delay: 100 }} * > * <App /> * </NavLinkProvider> */ export declare const NavLinkProvider: React.FC<NavLinkProviderProps>; /** * Hook to access NavLinkContext * * @returns {NavLinkContextValue} The current NavLink context value * * @example * // Access context in a component * const { routerContext, prefetchDefaults } = useNavLinkContext(); */ export declare const useNavLinkContext: () => NavLinkContextValue; export {}; //# sourceMappingURL=NavContext.d.ts.map