UNPKG

@mui/internal-docs-infra

Version:

MUI Infra - internal documentation creation tools.

50 lines 1.33 kB
export interface UseUrlHashStateOptions { /** * Whether to automatically read the hash on mount * @default true */ readOnMount?: boolean; /** * Whether to automatically watch for hash changes * @default true */ watchChanges?: boolean; /** * Custom hash parser function * @default (hash) => hash.slice(1) // Remove the '#' */ parseHash?: (hash: string) => string; /** * Custom hash formatter function * @default (value) => value */ formatHash?: (value: string) => string; } export interface UseUrlHashStateResult { /** * Current hash value (without the '#') */ hash: string | null; /** * Set a new hash value (will update the URL) * @param value - New hash value * @param replace - Whether to use replaceState instead of pushState */ setHash: (value: string | null, replace?: boolean) => void; /** * Whether the initial hash has been processed */ hasProcessedInitialHash: boolean; /** * Whether the user has explicitly interacted with the hash */ hasUserInteraction: boolean; /** * Mark that user has interacted with the hash */ markUserInteraction: () => void; } /** * Hook for managing URL hash state with SSR support */ export declare function useUrlHashState(options?: UseUrlHashStateOptions): UseUrlHashStateResult;