single-click-highlightable

1.0.0 • Public • Published

SingleClickHighlightable

Build Status

SingleClickHighlightable is a HOC for React that allows users to highlight text (copy/paste) on elements without triggering the element's onClick handler.


SingleClickHighlightable is currently used in production in our internal tool at Venmo.

Installation

npm install --save single-click-highlightable

This assumes that you’re using npm.

Example

import React, { Component } from 'react';
import SingleClickHighlightable from '../index';
 
export const TEXT = 'this is our test div';
 
export default class App extends Component {
  constructor() {
    super();
  }
 
  render() {
    return (
      <SingleClickHighlightable>
        <div className="test-div" onClick={this.props.onClick}>
          {TEXT}
        </div>
      </SingleClickHighlightable>
    );
  }
}

Development

Please take a look at package.json for available npm scripts.

For running tests: npm run test

For compiling src directory into dist directory with babel: npm run build

Contributing

We'd love for you to contribute.

Please open PRs from your fork to master. Rebase and squash when appropriate.

License

MIT

Package Sidebar

Install

npm i single-click-highlightable

Weekly Downloads

1

Version

1.0.0

License

ISC

Last publish

Collaborators

  • lindsaylevine