--- category: Elements --- # useIntersectionObserver Detects that a target element's visibility. ## Usage ```vue ``` ## Directive Usage ```vue ``` [IntersectionObserver MDN](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/IntersectionObserver) ## Type Declarations ```ts export interface UseIntersectionObserverOptions extends ConfigurableWindow { /** * Start the IntersectionObserver immediately on creation * * @default true */ immediate?: boolean /** * The Element or Document whose bounds are used as the bounding box when testing for intersection. */ root?: MaybeComputedElementRef | Document /** * A string which specifies a set of offsets to add to the root's bounding_box when calculating intersections. */ rootMargin?: string /** * Either a single number or an array of numbers between 0.0 and 1. * @default 0 */ threshold?: number | number[] } export interface UseIntersectionObserverReturn extends Pausable { isSupported: ComputedRef stop: () => void } /** * Detects that a target element's visibility. * * @see https://vueuse.org/useIntersectionObserver * @param target * @param callback * @param options */ export declare function useIntersectionObserver( target: | MaybeComputedElementRef | MaybeRefOrGetter | MaybeComputedElementRef[], callback: IntersectionObserverCallback, options?: UseIntersectionObserverOptions, ): UseIntersectionObserverReturn ```