{"id":14971096,"url":"https://github.com/captain-woof/react-intersection-revealer","last_synced_at":"2026-03-02T13:01:52.640Z","repository":{"id":46153838,"uuid":"410268645","full_name":"captain-woof/react-intersection-revealer","owner":"captain-woof","description":"An easy-to-use React hook that tells you whether a component/element is visible on the viewport currently, and if yes, how much of it is visible.","archived":false,"fork":false,"pushed_at":"2021-11-13T07:07:01.000Z","size":771,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-05T21:57:01.520Z","etag":null,"topics":["bounding-box","component","hooks","intersection","inview","lazy-load","react","react-intersection-observer","react-intersection-revealer","reacthook","reacthooks","reactjs","scroll","viewport"],"latest_commit_sha":null,"homepage":"https://captain-woof.github.io/react-intersection-revealer/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/captain-woof.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"custom":["https://www.buymeacoffee.com/captainwoof"]}},"created_at":"2021-09-25T12:37:17.000Z","updated_at":"2022-06-10T03:19:34.000Z","dependencies_parsed_at":"2022-09-03T22:02:38.053Z","dependency_job_id":null,"html_url":"https://github.com/captain-woof/react-intersection-revealer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/captain-woof/react-intersection-revealer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/captain-woof%2Freact-intersection-revealer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/captain-woof%2Freact-intersection-revealer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/captain-woof%2Freact-intersection-revealer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/captain-woof%2Freact-intersection-revealer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/captain-woof","download_url":"https://codeload.github.com/captain-woof/react-intersection-revealer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/captain-woof%2Freact-intersection-revealer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30003468,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T12:19:43.414Z","status":"ssl_error","status_checked_at":"2026-03-02T12:19:02.215Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bounding-box","component","hooks","intersection","inview","lazy-load","react","react-intersection-observer","react-intersection-revealer","reacthook","reacthooks","reactjs","scroll","viewport"],"created_at":"2024-09-24T13:44:42.626Z","updated_at":"2026-03-02T13:01:52.597Z","avatar_url":"https://github.com/captain-woof.png","language":"TypeScript","funding_links":["https://www.buymeacoffee.com/captainwoof","https://img.buymeacoffee.com/button-api/?text=Buy%20me%20a%20coffee\u0026emoji=\u0026slug=captainwoof\u0026button_colour=FFDD00\u0026font_colour=000000\u0026font_family=Lato\u0026outline_colour=000000\u0026coffee_colour=ffffff"],"categories":[],"sub_categories":[],"readme":"# react-intersection-revealer\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"640\" height=\"232\" src=\"https://drive.google.com/uc?export=download\u0026id=1tJxmTfwqaCCKnDlcFNIA7S85ijLJdvvO\"\u003e\n\u003c/p\u003e\n\n![GitHub search hit counter](https://img.shields.io/github/search/captain-woof/react-intersection-revealer/goto?color=%23ffee00) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-intersection-revealer?color=%236969b3) ![npm](https://img.shields.io/npm/dm/react-intersection-revealer?color=%2351ae17) ![NPM](https://img.shields.io/npm/l/react-intersection-revealer?color=%23f55d3e) ![npm](https://img.shields.io/npm/v/react-intersection-revealer?color=%2366101f)\n\n\u003e Think `react-intersection-observer`, but with more features.\n\n## Introduction\n\n**`react-intersection-revealer` is a easy-to-use React hook that tells you whether a component/element is visible on the viewport currently, and if yes, how much of it is visible.** The stats get updated when a relevant event occurs.\n\n## Install\n\nInstalling is easy. Do it like any other package.\n\n```bash\nnpm install --save react-intersection-revealer\n```\n\n## Quick Start\n\nThis example below is enough to get you started on how to use `react-intersection-revealer`.\n\n```jsx\nimport React, {useRef} from 'react'\nimport {useIntersectionRevealer} from 'react-intersection-revealer'\n\nexport default function YourAwesomeComponent(){\n  const ref = useRef()\n  const {heightVisible} = useIntersectionRevealer(ref)\n\n  return(\n    \u003c\u003e\n      \u003cdiv className=\"need-to-track\" ref={ref}\u003e...\u003c/div\u003e\n      \u003cp\u003e{`${heightVisible}px (height) of the tracked element is on screen`}\u003c/p\u003e\n    \u003c/\u003e\n  )\n}\n```\n**Here's a [demo](https://sohail-saha.in/react-intersection-revealer/) to show `react-intersection-revealer`'s capabilities.**\n\n## Usage\n\n**The `useIntersectionRevealer` hook provides you with 13 states that hold stats of the target element:**\n\n- **inView** *(Boolean)*: True if the element is visible, even if only partially. False otherwise.\n- **visibleFractionX** *(Decimal)*: Fraction of the element's width which is visible; range: [0,1].\n- **visibleFractionY** *(Decimal)*: Fraction of the element's height which is visible; range: [0,1].\n- **height** *(Decimal)*: The element's height, in pixels.\n- **width** *(Decimal)*: The element's width, in pixels.\n- **heightVisible** *(Decimal)*: The width (pixels) of the element's height which is visible.\n- **widthVisible** *(Decimal)*: The width (pixels) of the element's width which is visible.\n- **x** *(Decimal)*: The x coordinate (pixels) of the element from origin where it's rendered.\n- **y** *(Decimal)*: The y coordinate (pixels) of the element from origin where it's rendered.\n- **scrollX** *(Decimal)*: The amount of the element that was scrolled passed by, along x-axis.\n- **scrollXProgress** *(Decimal)*: The fraction of the amount of the element that was scrolled passed by, along x-axis; range: [0,1].\n- **scrollY** *(Decimal)*: The amount of the element that was scrolled passed by, along y-axis.\n- **scrollYProgress** *(Decimal)*: The fraction of the amount of the element that was scrolled passed by, along y-axis; range: [0,1].\n\n**These stats get updated on any of these events:**\n  - Viewport resize *(window - onresize)*\n  - Page scroll *(window - onscroll)*\n  - Parent element scroll *(parentElement - onscroll)*\n  - Target element's transition-end *(targetElement - ontransitionend)*\n  - Parent element's transition-end *(parentElement - ontransitionend)*\n\n**The hook requires a reference to the element to be tracked.** Use the `useRef` hook (from React), get a reference, and pass it to both the `useIntersectionRevealer` hook and the element/component you want to track.\n\nThat's all you need to do.\n\n**Take a look at the [demo site](https://sohail-saha.in/react-intersection-revealer/), and [its source code](https://github.com/captain-woof/react-intersection-revealer/tree/master/example) to get an idea.**\n\n## License\n\nMIT © [captain-woof](https://github.com/captain-woof)\n\n## Author\n\n**[Sohail Saha (aka CaptainWoof)](https://sohail-saha.in)**\n\n[![Buy me a coffee](https://img.buymeacoffee.com/button-api/?text=Buy%20me%20a%20coffee\u0026emoji=\u0026slug=captainwoof\u0026button_colour=FFDD00\u0026font_colour=000000\u0026font_family=Lato\u0026outline_colour=000000\u0026coffee_colour=ffffff)](https://www.buymeacoffee.com/captainwoof)\n\n*Please consider supporting me if you find this package useful in your work.*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaptain-woof%2Freact-intersection-revealer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaptain-woof%2Freact-intersection-revealer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaptain-woof%2Freact-intersection-revealer/lists"}