react-active-menu
Version:
A React hook to build an active scrolling menu navigation.
18 lines (17 loc) • 651 B
TypeScript
export interface UseScrollMenuOptions {
offset?: number;
onActiveChange?: (attributes: ScrollMenuAttributes) => void;
}
export interface ScrollMenuAttributes {
active?: string;
isTransitioning: boolean;
sectionRefs: Record<string, HTMLElement>;
triggerRefs: Record<string, HTMLElement>;
}
export interface ScrollMenu {
active?: string;
handleTriggerClick: (id: string) => (e: MouseEvent) => void;
registerSectionRef: (id: string) => (ref: HTMLElement) => void;
registerTriggerRef: (id: string) => (ref: HTMLElement) => void;
}
export declare const useScrollMenu: (options?: UseScrollMenuOptions) => ScrollMenu;