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

https://github.com/danrpts/react-cursor-dropdown

A React HOC for adding cursor dropdown menus to textareas and text inputs.
https://github.com/danrpts/react-cursor-dropdown

cursor dropdown hoc input react textarea

Last synced: 3 months ago
JSON representation

A React HOC for adding cursor dropdown menus to textareas and text inputs.

Awesome Lists containing this project

README

        

# react-cursor-dropdown

> A React HOC for adding cursor dropdown menus to textareas and inputs - [Try it out!](https://superdan.io/react-cursor-dropdown/)

[![NPM](https://img.shields.io/npm/v/react-cursor-dropdown.svg)](https://www.npmjs.com/package/react-cursor-dropdown) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Install

```bash
npm install --save react-cursor-dropdown
```

## Usage

```jsx
import React, { Component } from "react";

import { WithCursorDropdown, CursorDropdown } from "react-cursor-dropdown";

// Import the component you want to dropdown from the cursor
import SomeListComponent from "SomeListComponent";

const Input = props => ;
const InputWithCursorDropdown = WithCursorDropdown(Input);

class App extends Component {
constructor(props) {
super(props);

this.state = {
value: ""
};

this.handleChange = ({ target }) => {
this.setState({
value: target.value
});
};

this.handleCursorDropdownChange = ({ value, cursor }) => {
// Do something with the value from the dropdown
};
}

render() {
return (

// Specify the regex to match against the current word (capture group
required)


);
}
}
```

## License

MIT © [danrpts](https://github.com/danrpts)