BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/Unlumen Ui/hooks-use-is-in-view

useIsInView

unlumen-ui/hooks-use-is-in-view
FreeHook

A hook that allows you to check if an element is in view.

Live preview

live · rendered by the registry
Rendered by Unlumen Ui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://ui.unlumen.com/r/hooks-use-is-in-view.json

Source

registry/hooks/use-is-in-view/index.tsxui.unlumen.com/r/hooks-use-is-in-view.json
1import * as React from "react";
2import { useInView, type UseInViewOptions } from "motion/react";
3
4interface UseIsInViewOptions {
5 inView?: boolean;
6 inViewOnce?: boolean;
7 inViewMargin?: UseInViewOptions["margin"];
8}
9
10function useIsInView<T extends HTMLElement = HTMLElement>(
11 ref: React.Ref<T>,
12 options: UseIsInViewOptions = {},
13) {
14 const { inView, inViewOnce = false, inViewMargin = "0px" } = options;
15 const localRef = React.useRef<T>(null);
16 React.useImperativeHandle(ref, () => localRef.current as T);
17 const inViewResult = useInView(localRef, {
18 once: inViewOnce,
19 margin: inViewMargin,
20 });
21 const isInView = !inView || inViewResult;
22 return { ref: localRef, isInView };
23}
24
25export { useIsInView, type UseIsInViewOptions };

What it pulls in

npm packages

  • motion

Files it writes

  • registry/hooks/use-is-in-view/index.tsx

Facts

Registry
Unlumen Ui
Type
registry:hook
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-03
Last confirmed
today

Go to the source

Docs on Unlumen Ui ui.unlumen.com leovvx/unlumen-ui-docs on GitHub Raw registry item This item as JSON

More from Unlumen Ui

All 225 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
useAutoHeighthooks-use-auto-heightUnlumen UiHooksFreeno deps
Use Controlled Statehooks-use-controlled-stateUnlumen UiHooksFreeno deps
useDataStatehooks-use-data-stateUnlumen UiHooksFreeno deps
useMotionValueStatehooks-use-motion-value-stateUnlumen UiHooksFree1 dep
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex