{"id":19686315,"url":"https://github.com/closeio/use-is-truncated","last_synced_at":"2026-04-15T00:32:25.516Z","repository":{"id":38997978,"uuid":"380955980","full_name":"closeio/use-is-truncated","owner":"closeio","description":"Simple React hook that allows you to determine whether an element is truncated via CSS or not","archived":false,"fork":false,"pushed_at":"2023-01-06T20:14:37.000Z","size":1466,"stargazers_count":2,"open_issues_count":26,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-09-04T15:23:21.668Z","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/closeio.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":"2021-06-28T08:13:02.000Z","updated_at":"2022-08-27T18:24:02.000Z","dependencies_parsed_at":"2023-02-06T08:31:17.015Z","dependency_job_id":null,"html_url":"https://github.com/closeio/use-is-truncated","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/closeio/use-is-truncated","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/closeio%2Fuse-is-truncated","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/closeio%2Fuse-is-truncated/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/closeio%2Fuse-is-truncated/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/closeio%2Fuse-is-truncated/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/closeio","download_url":"https://codeload.github.com/closeio/use-is-truncated/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/closeio%2Fuse-is-truncated/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31821532,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T18:05:02.291Z","status":"ssl_error","status_checked_at":"2026-04-14T18:05:01.765Z","response_time":153,"last_error":"SSL_read: 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":[],"created_at":"2024-11-11T18:27:29.003Z","updated_at":"2026-04-15T00:32:25.447Z","avatar_url":"https://github.com/closeio.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# use-is-truncated\n\n[![NPM](https://img.shields.io/npm/v/@closeio/use-is-truncated.svg)](https://www.npmjs.com/package/@closeio/use-is-truncated) [![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-success)](https://prettier.io)\n\nSimple React hook that allows you to determine whether an element is truncated via CSS or not.\n\n[Check the live DEMO](https://closeio.github.io/use-is-truncated/).\n\n### \u003cimg height=\"40px\" src=\"./close.svg\" /\u003e\n\nInterested in working on projects like this? [Close](https://close.com) is looking for [great engineers](https://jobs.close.com) to join our team!\n\n## Install\n\n```bash\nyarn add @closeio/use-is-truncated\n```\n\n## Usage\n\n### Show a tooltip for elements that are truncated\n\n```jsx\nimport React from 'react';\nimport useIsTruncated from '@closeio/use-is-truncated';\n\nconst TooltipTruncated = ({ content, children }) =\u003e {\n  const [ref, isTruncated] = useIsTruncated(children);\n\n  return React.cloneElement(children, {\n    ref,\n    title: isTruncated ? content : null,\n  });\n};\n\nconst MyOverlyLongLabel = () =\u003e (\n  \u003cTooltipTruncated content=\"This is a label that is too long to show\"\u003e\n    \u003cdiv className=\"MyLabel\"\u003eThis is a label that is too long to show\u003c/div\u003e\n  \u003c/TooltipTruncated\u003e\n);\n```\n\n```css\n.MyLabel {\n  width: 100px;\n  overflow: hidden;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n}\n```\n\n## License\n\nMIT © [Close](https://github.com/closeio)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloseio%2Fuse-is-truncated","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloseio%2Fuse-is-truncated","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloseio%2Fuse-is-truncated/lists"}