# Directives Some common Vue directives that are useful in building frontend apps. ## onOutsideClick This directive can be used to listen for click events outside of the target element. In the following example, the div with border has the directive, so clicks outside the div will trigger the `setInactive` function. ```vue ``` ## visibility This directive allows you to trigger a function whenever an element becomes visible in the viewport. In the following example, whenever the visibility of the gray box is changed, the values `visible` and `intersectionRatio` are updated. This feature internally uses the [IntersectionObserver API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API), and the second parameter to the function is the [`entry` object](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserverEntry). ```vue ```