
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
react-selection-popover
Advanced tools
Popover menu for selected text
Add the SelectionPopover component as a sibling of the element that contains the selectable text. Add the data-selectable attribute to the element that contains the selectable text. Make sure the common parent has its position set to relative.
Add any children and props (including styling) to SelectionPopover.
import React from 'react';
import SelectionPopover from 'react-selection-popover'
export default class Demo extends React.Component {
render() {
state = {
showPopover: false
}
return (
<div style={{
position: 'relative'
}}>
<div data-selectable>
<p>
This is the first selectable paragraph. Looking pretty good.
</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing.
</p>
</div>
<SelectionPopover
showPopover={this.state.showPopover}
onTextSelect={() => {this.setState({showPopover: true})}}
onTextDeselect={() => {this.setState({showPopover: false})}}
>
<button>save</button>
<button>share</button>
</SelectionPopover>
</div>
)
}
}
| prop | description | type | required |
|---|---|---|---|
topOffset | distance from selection and top of box (default 30px) | integer | false |
style | any ole style prop | object | false |
onTextDeselect | fired when text selection is cleared | function | true |
onTextSelect | fired when text is selected | function<selectedText: string> | true |
showPopover | shows or hides the popover | boolean | true |
You can pass any other div compatible props
Clone repo then
npm install
npm start
react-selection-popover is available under MIT. See LICENSE for more details.
FAQs
A medium-like popover menu for selected text
We found that react-selection-popover 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.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.