Skip to content

HOC for React that allows users to highlight text on elements without triggering the onClick handler

License

Notifications You must be signed in to change notification settings

venmo/single-click-highlightable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

HOC for React that allows users to highlight text on elements without triggering the onClick handler

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published