react-roving-focus
Version:
Flexible roving focus for React with support for any fixed or responsive layout.
12 lines (11 loc) • 623 B
TypeScript
import { Direction, ElementCallbacks, FocusableElement } from './types.js';
export interface RovingFocusContextValue {
registerElement: (element: FocusableElement, callbacks: ElementCallbacks) => void;
unregisterElement: (element: FocusableElement) => void;
setFocusedElement: (element: FocusableElement) => void;
focusNextElement: (direction: Direction) => void;
focusFirstElement: () => void;
focusLastElement: () => void;
}
export declare const RovingFocusContext: import('react').Context<RovingFocusContextValue | null>;
export declare function useRovingFocusContext(): RovingFocusContextValue;