useScrollLock

A custom hook that locks and unlocks scroll.

A custom hook that locks and unlocks scroll.

Usage

import { useScrollLock } from "@tilt-legal/cubitt-components/utilities/hooks";

// Lock the scroll when the modal is mounted, and unlock it when it's unmounted
useScrollLock()

API

Signature

declare function useScrollLock(options?: UseScrollLockOptions): UseScrollLockReturn;

Parameters

ParameterTypeDescriptionDefault
[options]UseScrollLockOptionsOptions to configure the hook, by default it will lock the scroll automatically.-

Return Value

ValueTypeDescription
returnUseScrollLockReturn- An object containing the lock and unlock functions.

On this page