0.3.2 • Published 6 years ago

@jonstuebe/react-text-selection v0.3.2

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

React Text Selection

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

Install

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

Usage

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

const App = () => (
  <div>
    <TextSelection>
      {({ eventProps, selectionStart, selectionEnd }) => (
        <div>
          <p>
            {selectionStart}/{selectionEnd}
          </p>
          <textarea className="form-control" {...eventProps} />
        </div>
      )}
    </TextSelection>
  </div>
);

Codepen Example

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

IE / EdgeFirefoxChromeSafari
IE10, IE11, Edgelast 4 versionslast 4 versionslast 4 versions
0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago