Utility Hooks
A collection of utility hooks for common UI patterns including notifications, path observation, popover management, and section tracking.
useNotification API
Returns
Prop | Default | Type |
|---|---|---|
showNotification | undefined | (props: NotificationProps) => void |
usePathObserver API
Returns
Prop | Default | Type |
|---|---|---|
Returns | "" | string |
usePopover API
Parameters
Prop | Default | Type |
|---|---|---|
offset | undefined | { x?: number; y?: number } |
itemCallbacks | undefined | Array<(() => void) | undefined> |
usePopover Return Value
Returns
Prop | Default | Type |
|---|---|---|
isOpen | false | boolean |
setIsOpen | undefined | (open: boolean) => void |
menuPosition | undefined | { top: number; left: number; position: 'below' | 'above'; width: number } |
triggerRef | null | RefObject<T> |
contentRef | null | RefObject<U> |
handleKeyDown | undefined | (e: React.KeyboardEvent) => void |
selectedOptionIndex | null | number | null |
highlightedIndex | -1 | number |
useActiveSectionObserver API
Parameters
Prop | Default | Type |
|---|---|---|
selectors | "h2" | string |
rootMargin | "-20% 0px -70% 0px" | string |
useActiveSectionObserver Return Value
Returns
Prop | Default | Type |
|---|---|---|
Returns | null | string | null |