Skip to content

useBoosterComponentObserver

Options

PropertyTypeDescriptionDefault Value
rootHTMLElementMDN rootundefined
rootMarginStringMDN rootMargin'0px'
thresholdArrayMDN threshold[0]
trackVisibilityBooleanMDN trackVisibilityfalse
delayNumberMDN delay0

Return

PropertyTypeDescription
elObjectComponent ref for tag referencing.
inViewBooleanReference that indicates whether referenced element is visible.

Example

html
<template>
  <div ref="target" :class="{visible: inView}">

  </div>
</template>

<script setup>
const { el: target, inView } = useBoosterComponentObserver({
  trackVisibility: true,
  delay: 350
});
</script>