{"id":21291672,"url":"https://github.com/komlev/tiny-use-detect-horizontal-overflow","last_synced_at":"2025-06-17T02:38:49.752Z","repository":{"id":57998613,"uuid":"529570075","full_name":"komlev/tiny-use-detect-horizontal-overflow","owner":"komlev","description":null,"archived":false,"fork":false,"pushed_at":"2022-08-29T12:08:11.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-15T16:36:14.663Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/komlev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-27T11:48:31.000Z","updated_at":"2022-08-27T11:57:16.000Z","dependencies_parsed_at":"2023-01-16T19:00:54.041Z","dependency_job_id":null,"html_url":"https://github.com/komlev/tiny-use-detect-horizontal-overflow","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/komlev/tiny-use-detect-horizontal-overflow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komlev%2Ftiny-use-detect-horizontal-overflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komlev%2Ftiny-use-detect-horizontal-overflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komlev%2Ftiny-use-detect-horizontal-overflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komlev%2Ftiny-use-detect-horizontal-overflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/komlev","download_url":"https://codeload.github.com/komlev/tiny-use-detect-horizontal-overflow/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komlev%2Ftiny-use-detect-horizontal-overflow/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260278944,"owners_count":22985374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-21T13:38:52.000Z","updated_at":"2025-06-17T02:38:49.737Z","avatar_url":"https://github.com/komlev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tiny-use-detect-horizontal-overflow\n\nSmall (~1 Kb) react hook for detecting items are overflown.\nSomething like this:\n\n\nhttps://user-images.githubusercontent.com/513452/187036364-28e55b05-2f6b-41d7-ab71-37df6b1d02a7.mp4\n\n\n## Usage\n\n```\nnpm i tiny-use-detect-horizontal-overflow --save\n```\n\nAnd in your react code\n\n```js\nimport { useDetectHorizontalOverflow } from \"tiny-use-detect-horizontal-overflow\";\n\n// ...\n\nuseDetectHorizontalOverflow(containerRef, (hiddenElements) =\u003e {\n  console.log(hiddenElements)\n  /*\n    It'll print out hidden elements which are overflown by container\n    (4) [li#Membeship, li#Register, li#Login, li#Learn]\n  */\n});\n```\n\n## API\n\nUsage:\nLet's say you have this JSX component\n```jsx\n\u003cdiv className=\"container\" ref={containerRef}\u003e\n  \u003cul className=\"links_list\" ref={listRef}\u003e\n    \u003cli\u003e\n      \u003ca href=\"/about\"\u003eAbout\u003c/a\u003e\n    \u003c/li\u003e\n    {/*...*/}\n  \u003c/ul\u003e\n\u003c/div\u003e\n```\n\nAnd in order to use this hook:\n\n```js\nuseDetectHorizontalOverflow(\n  containerRef, // react ref of container\n  (entries) =\u003e {}, // callback which will be called when number of hidden element is changed\n  listRef, // optional react ref for items parent - if items are not direct children of the container\n  throttleTimeout // optional timeout throttle timeout for resize callback, default is 16ms\n);\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkomlev%2Ftiny-use-detect-horizontal-overflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkomlev%2Ftiny-use-detect-horizontal-overflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkomlev%2Ftiny-use-detect-horizontal-overflow/lists"}