1.1.1 • Published 5 years ago

react-clickable-hoc v1.1.1

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

react-clickable-hoc

Build Status devDependencies Status

Executes onClick to keyboard actions for improved accessibility of your React components.

Pressing Enter or the space bar (onKeyDown) on the wrapped component will trigger onClick, if it exists.

Installation

Requires React v16.

npm install --save react-clickable-hoc

Usage

Simply import the module and wrap a component with it !

  import clickable from 'react-clickable-hoc';

  import Component from './path/to/Component';

  // Wrap the component using react-clickable-hoc.
  const WrappedComponent = clickable(Component);
  
  render() {
    const onClick = () => { console.log('clicked !') };
    // Use it like a normal component.
    return <WrappedComponent onClick={onClick} />
  }

License

MIT

1.1.1

5 years ago

1.1.0

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago