UNPKG

@supunlakmal/hooks

Version:

A collection of reusable React hooks

10 lines (9 loc) 526 B
import { RefObject } from 'react'; /** * Traps focus within a specified container element. * * @param containerRef - Ref object pointing to the container element. * @param isActive - Boolean indicating if the focus trap should be active. * @param initialFocusRef - Optional ref object pointing to the element that should receive focus initially. */ export declare const useFocusTrap: <T extends HTMLElement>(containerRef: RefObject<T | null>, isActive: boolean, initialFocusRef?: RefObject<HTMLElement | null>) => void;