react-textarea-autocomplete
v0.0.4
Published
Simple React Textarea component for autocomplete tags, hashtags, etc.
Downloads
565
Maintainers
Readme
React Textarea Autocomplete
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 || lock | 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