https://github.com/markoelez/react-selectable-text
React component providing controlled selection within a text display
https://github.com/markoelez/react-selectable-text
component react
Last synced: 6 months ago
JSON representation
React component providing controlled selection within a text display
- Host: GitHub
- URL: https://github.com/markoelez/react-selectable-text
- Owner: markoelez
- Created: 2020-02-18T23:20:28.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-02T17:27:29.000Z (over 3 years ago)
- Last Synced: 2025-10-27T04:41:36.228Z (8 months ago)
- Topics: component, react
- Language: JavaScript
- Homepage:
- Size: 105 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-selectable-text
## Install
`npm install react-selectable-text`
## Usage
```javascript
const handleSelect = selection => {
// deal with selection here
}
```
## Props
- `ranges`: ranges of text to mark
- `text`: text to mark
- `onMouseOverSelection`: callback when mouse is over a selection
- `onSelect`: callback when a selection is made
- `selectStyle`: style for selected text
- `storeSelect`: whether to store current selection until new selection is made
- `onEmptySelect`: callback for empty click (no text selected)