Skip to Content
ComponentsFxIn View

InView

An effect component that triggers entrance transitions or animations when it passes into the viewport. 
Detection of the element’s visibility in the viewport is performed using the Intersection Observer API.

Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do.

Basic Animation

Use the activeClassName and inactiveClassName props to apply CSS classes when the element is in or out of view.

Scroll to reveal animation
Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do.

Render Props

Use the isInView render prop to access the visibility state directly.
If you are using RSC remember to add the use client directive when accesing render props.

Scroll to reveal animation
0

Customizing

globals.css
:root { --ex-in-view-delay: 0; --ex-in-view-ease: var(--ease-out); --ex-in-view-duration: 500ms }

API

ElementSelector
InView.ex-in-view
PropTypeDefault
asElementTypespan
asChildbooleanfalse
activeClassNamestring
inactiveClassNamestring
initialInViewbooleanfalse
oncebooleanfalse
rootElement | Document | null
rootMarginstring
thresholdnumber | number[]
Last updated on