1.0.8 • Published 6 years ago
react-selectable-text v1.0.8
react-selectable-text
Install
npm install react-selectable-text
Usage
const handleSelect = selection => {
// deal with selection here
}
<SelectableText
ranges={[
{ start: 0, end: 50 },
{ start: 80, end: 120 }
]}
selectStyle={{ backgroundColor: '#ffcc80' }}
text={TEXT_STRING}
onSelect={handleSelect}
storeSelect={true}
/>Props
ranges: ranges of text to marktext: text to markonMouseOverSelection: callback when mouse is over a selectiononSelect: callback when a selection is madeselectStyle: style for selected textstoreSelect: whether to store current selection until new selection is madeonEmptySelect: callback for empty click (no text selected)