Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
react-highlight-pop
Advanced tools
React component for "medium-like" text highlight
A configurable text highlight component with zero dependencies
npm install react-highlight-pop
react-highlight-pop
after installationimport HighlightPop from 'react-highlight-pop';
or
const HighlightPop = require('react-highlight-pop');
react-highlight-pop
const App = () => {
return (
<HighlightPop>
<p>You can highlight me</p>
<p>I will show a popover when you highlight me</p>
</HighlightPop>
)
}
You can define custom popover items by defining the popoverItems
prop, whose value is a function that returns jsx.
NOTE: You should always pass your custom popover items.
Example
const App = () => {
return (
<HighlightPop
popoverItems={itemClass => (
<Fragment>
<span
className={itemClass} onClick={() => alert('sharing')}>
share
</span>
</Fragment>
)}>
<p>You can highlight me</p>
<p>I will show a popover when you highlight me</p>
</HighlightPop>
)
}
prop | value | description |
---|---|---|
popoverItems | function | A function that returns jsx. Returned jsx display as popover items when a text is highlighted. |
onHighlightPop | function | Callback function that's invoked whenever a text is highlighted. |
children | node | The text/group of text that's highlightable |
git checkout -b my-awesome-feature
)src/lib/index.js
__tests__/HighlightPop.test.js
git commit -am 'Awesome feature added'
)git push origin my-awesome-feature
)FAQs
React component for 'medium-like' text highlight
We found that react-highlight-pop demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.