@leafygreen-ui/hooks
Version:
LeafyGreen UI Kit Custom Hooks
25 lines • 607 B
TypeScript
import { RefObject } from 'react';
/**
* Automatically scrolls the container to
* ensure the elementRef is always at the top of the container.
*
* Required styles:
* ```css
* .container-parent {
* position: relative | absolute;
* }
*
* .container {
* position: relative;
* max-height: {number};
* overflow: auto;
* }
*
* .element {
* position: relative;
* height: {number}
* }
* ```
*/
export declare const useAutoScroll: (elementRef?: RefObject<HTMLElement>, containerRef?: RefObject<HTMLElement>, offset?: number) => void;
//# sourceMappingURL=useAutoScroll.d.ts.map