{"id":20199765,"url":"https://github.com/chideraike/react-highlight-popover","last_synced_at":"2025-06-11T22:36:31.060Z","repository":{"id":37461957,"uuid":"486306868","full_name":"chideraike/react-highlight-popover","owner":"chideraike","description":"Popover for text that is selected/highlighted. Like in a Medium blog.","archived":false,"fork":false,"pushed_at":"2024-04-09T08:44:49.000Z","size":841,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T09:52:53.741Z","etag":null,"topics":["highlight","medium","popover","react"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/react-highlight-popover","language":"TypeScript","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/chideraike.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-04-27T18:25:27.000Z","updated_at":"2024-07-31T23:15:13.000Z","dependencies_parsed_at":"2022-08-25T15:40:58.985Z","dependency_job_id":null,"html_url":"https://github.com/chideraike/react-highlight-popover","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chideraike%2Freact-highlight-popover","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chideraike%2Freact-highlight-popover/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chideraike%2Freact-highlight-popover/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chideraike%2Freact-highlight-popover/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chideraike","download_url":"https://codeload.github.com/chideraike/react-highlight-popover/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248208550,"owners_count":21065202,"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":["highlight","medium","popover","react"],"created_at":"2024-11-14T04:38:47.776Z","updated_at":"2025-04-10T11:09:04.607Z","avatar_url":"https://github.com/chideraike.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-highlight-popover\n\u003e React component to show popover for a text that is selected/highlighted.\n\n![npm](https://img.shields.io/npm/v/react-highlight-popover?logo=npm\u0026style=flat-square)\n![GitHub Actions](https://img.shields.io/github/actions/workflow/status/chideraike/react-highlight-popover/publish.yml?branch=main\u0026style=flat-square)\n![npm](https://img.shields.io/npm/dm/react-highlight-popover?style=flat-square)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release)\n\nA highly customizable text highlight react component with zero dependencies.\n\n![Demo](https://user-images.githubusercontent.com/42821245/166227004-25300342-1da1-4552-a8cf-6f6a7154bff2.gif)\n\n## Installation\n```bash\nnpm install react-highlight-popover\n```\nor\n```bash\nyarn add react-highlight-popover\n```\n\n## Usage\n1. Import `HighlightableTextArea` after installation\n```js\nimport { HighlightableTextArea } from 'react-highlight-popover';\n```\n2. Wrap the text you want to be highlightable with `HighlightableTextArea`\n```js\nfunction App() {\n    return (\n        \u003cHighlightableTextArea\u003e\n            \u003cp\u003eThis is a sample text that can be highlighted. Select some text from here to see.\u003c/p\u003e\n        \u003c/HighlightableTextArea\u003e\n    )\n}\n```\n\n### Customize your popover item\nYou can define a custom popover item by defining the `popoverItem` prop, whose value is a function that returns a react node. It also takes `HighlightedText` \u0026 `setPopoverState` as optional arguments.\n\nExample\n```js\nfunction App() {\n    return (\n        \u003cHighlightableTextArea \n            popoverItem={(HighlightedText, setPopoverState) =\u003e {\n                return (\n                    \u003cdiv onClick={() =\u003e setPopoverState(false)}\u003e\n                        \u003cp\u003e{HighlightedText}\u003c/p\u003e\n                    \u003c/div\u003e\n                )}}\n        \u003e\n            \u003cp\u003eThis is a sample text that can be highlighted. Select some text from here to see.\u003c/p\u003e\n        \u003c/HighlightableTextArea\u003e\n    )\n}\n```\n\n# API\n## Props\nName|Default value|Description|Required\n---|---|---|---\nchildren||The part in which text that is selected/highlighted will render a popover.|Yes\npopoverItem||The item to be rendered as popover when user has selected/highlighted text.|No\nonHighlightText||The callback function that is fired when the popover shows, or hides.|No\nxOffset|0|Positions the popover along the x-axis of the selected text.|No\nyOffset|10|Positions the popover along the y-axis of the selected text.|No\nzIndex|10|Sets the z-order of the popover and its descendants or flex items.|No\n\n\u003e Need new features? Create an issue [here](https://github.com/chideraike/react-highlight-popover/issues/new)\n\n## Contribute\n1. Fork the repo \n2. Create your feature branch (`git checkout -b my-awesome-feature`)\n3. Make changes to the index file `src/index.tsx`\n4. Write test for changes/features added in `tests/blah.test.tsx`\n5. Commit your changes (`git add . \u0026\u0026 npm run commit`)\n6. Push to the branch (`git push origin my-awesome-feature`)\n7. Raise a Pull Request\n\n## License\n**react-highlight-popover** is licensed under [MIT](https://github.com/chideraike/react-highlight-popover/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchideraike%2Freact-highlight-popover","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchideraike%2Freact-highlight-popover","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchideraike%2Freact-highlight-popover/lists"}