UNPKG

@leafygreen-ui/hooks

Version:
37 lines 751 B
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: ( /** * The element to keep at the top */ elementRef?: RefObject<HTMLElement>, /** * The container element */ containerRef?: RefObject<HTMLElement>, /** * A vertical offset amount to account for padding/margin */ offset?: number) => void; //# sourceMappingURL=useAutoScroll.d.ts.map