@lesnoypudge/utils-react
Version:
lesnoypudge's utils-react
37 lines (36 loc) • 1.03 kB
TypeScript
import { useRefManager } from '../useRefManager';
export declare namespace useScrollIntoView {
type Options = {
/**
* @default 'instant'
*/
behavior?: ScrollBehavior;
/**
* Alias for 'block'
* @default 'center'
*/
vertical?: ScrollLogicalPosition;
/**
* Alias for 'inline'
* @default 'center'
*/
horizontal?: ScrollLogicalPosition;
/**
* @default false;
*/
enabled?: boolean;
};
type Args = [
elementRef: useRefManager.NullableRefManager<HTMLElement>,
options?: Options
];
type Return = {
scrollIntoView: VoidFunction;
};
}
/**
* Provides a function to scroll an element into view
* with configurable options. Executes automatically
* if enabled.
*/
export declare const useScrollIntoView: (elementRef: useRefManager.NullableRefManager<HTMLElement>, options?: useScrollIntoView.Options | undefined) => useScrollIntoView.Return;