An open API service indexing awesome lists of open source software.

https://github.com/jonstuebe/react-text-selection

Render prop callback function to provide text selection for text inputs, textarea's, etc.
https://github.com/jonstuebe/react-text-selection

component javascript react reactjs render-prop

Last synced: 11 months ago
JSON representation

Render prop callback function to provide text selection for text inputs, textarea's, etc.

Awesome Lists containing this project

README

          

# React Text Selection

Render prop callback function to provide text selection for text inputs, textarea's, etc. _Includes UMD build_

## Install

```shell
npm i -s @jonstuebe/react-text-selection
```

## Usage

```javascript
import React from "react";
import TextSelection from "@jonstuebe/react-text-selection";

const App = () => (



{({ eventProps, selectionStart, selectionEnd }) => (


{selectionStart}/{selectionEnd}




)}


);
```

#### Codepen Example

https://codepen.io/jonstuebe/pen/zpBwrL?editors=0010

| [IE / Edge](http://godban.github.io/browsers-support-badges/)IE / Edge | [Firefox](http://godban.github.io/browsers-support-badges/)Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)Chrome | [Safari](http://godban.github.io/browsers-support-badges/)Safari |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| IE10, IE11, Edge | last 4 versions | last 4 versions | last 4 versions |