UNPKG

@scalar/api-client

Version:

the open source API testing client

28 lines 1.14 kB
import { type MaybeRefOrGetter } from 'vue'; /** * useScrollLock - A Vue composition function to lock and unlock scrolling on a specific element. * * This hook provides a computed ref that allows you to enable or disable scrolling on a given HTMLElement. * Locking sets the element's `overflow` style to `'hidden'`. * Unlocking restores the original `overflow` value. * * The lock state will be automatically cleaned up (unlocked) when the component is unmounted. * * @param element - MaybeRefOrGetter for the HTMLElement to lock scrolling on. Can be a ref or a function. * @returns A computed ref: assign `true` to lock, `false` to unlock, read for current state. * * @example * ```ts * // In your setup(): * const container = ref<HTMLElement | null>(null) * const scrollLock = useScrollLock(container) * * // To lock scrolling: * scrollLock.value = true * * // To unlock scrolling: * scrollLock.value = false * ``` */ export declare const useScrollLock: (element: MaybeRefOrGetter<HTMLElement | null | undefined>) => import("vue").WritableComputedRef<boolean, boolean>; //# sourceMappingURL=use-scroll-lock.d.ts.map