BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/dashboardblocks/use-in-view

Use In View

dashboardblocks/use-in-view
FreeHook

A hook that tracks whether an element is visible in the viewport using IntersectionObserver.

Install it

npx shadcn@latest add https://dashboardblocks.com/r/use-in-view.json

Source

registry/hooks/use-in-view.tsxdashboardblocks.com/r/use-in-view.json
1'use client'
2
3import { useLayoutEffect, useRef, useState } from 'react'
4
5interface UseInViewOptions {
6 /**
7 * Intersection Observer threshold (0-1)
8 * @default 1.0
9 */
10 threshold?: number
11 /**
12 * Intersection Observer root margin
13 * @default '0px'
14 */
15 rootMargin?: string
16}
17
18/**
19 * A hook that tracks whether an element is visible in the viewport using IntersectionObserver.
20 * @returns An object containing a ref to attach to the element and an isInView boolean state.
21 */
22export function useInView(options: UseInViewOptions = {}) {
23 const { rootMargin = '0px', threshold = 1.0 } = options
24
25 const ref = useRef<HTMLElement | null>(null)
26 const [isInView, setIsInView] = useState(false)
27
28 useLayoutEffect(() => {
29 const element = ref.current
30 if (!element) return
31
32 const observer = new IntersectionObserver(
33 ([entry]) => {
34 setIsInView(entry.isIntersecting)
35 },
36 { threshold, rootMargin },
37 )
38
39 observer.observe(element)
40
41 return () => {
42 observer.disconnect()
43 }
44 }, [rootMargin, threshold])
45
46 return {
47 isInView,
48 ref,
49 }
50}

Files it writes

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

Facts

Registry
dashboardblocks
Type
registry:hook
Access
Free
Files written
1
Licence
MIT
In the index
at or before 2026-08-12
Last confirmed
yesterday

Go to the source

dashboardblocks.com LGLabGreg/dashboardblocks on GitHub Raw registry item This item as JSON

More from dashboardblocks

All 36 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Use Animated Numberuse-animated-numberdashboardblocksHooksFreeno deps

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

ToolDrift

What the AI coding tools changed last night

tooldrift.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

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

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

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

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

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

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex