react-textarea-autocomplete

0.0.4 • Public • Published

React Textarea Autocomplete


Simple React Textarea component for autocomplete hashtags, tags etc.

Installation

npm install react-textarea-autocomplete

DEMO

Usage

import React, { Component } from 'react'
import TextareaAutocomplete from 'react-textarea-autocomplete'
 
class App extends Component {
  render () {
    const fruts = [
      'tacos',
      'blackberry',
      'watermelon',
      'kiwi',
      'chili',
      'lemon',
      'orange',
      'pineaple'
    ]
 
    return (
      <div>
        <TextareaAutocomplete
          list={fruts}
          char='#'
        />
      </div>
    )
  }
}
 

PropTypes

Prop Name Type Default Description
list Array [ ] List of items ans suggest
minChar Number 2 Min characters for trigger after the char #
char String # Character of search, example #
maxSuggest Number [ ] Max lenght of items in suggest
mode String infinite Behavior in key navegations infinite
addChar Boolean true Adds the character in textarea when is selected
limitToParent Boolean false Restrict ul list position in the parent's width
showCharInList Boolean true Adds the character in the select list
spellcheck Boolean false Spellcheck in textarea
listClass String "" Custom class css in the ul list
activeItemClass String "" Custom class css in the li item active
inactiveItemClass String "" Custom class css in the li item inactive
activeItemStyle Object { } Styles in active item
inactiveItemStyle Object { } Styles in inactive item
charStyle Object { } Char styles in the item

This component uses Standard JS

JavaScript Style Guide

Package Sidebar

Install

npm i react-textarea-autocomplete

Weekly Downloads

106

Version

0.0.4

License

MIT

Unpacked Size

26.4 kB

Total Files

5

Last publish

Collaborators

  • gerardogallegos