1.2.7 • Published 6 years ago

react-predictive-text v1.2.7

Weekly downloads
6
License
ISC
Repository
github
Last release
6 years ago

React Predictive Text

A low-level, versatile autocomplete component for React

Installation

via NPM

  • install locally to your project: npm install --save react-predictive-text@latest;

Usage

Import the component to your file as follows:

`import PText from "react-predictive-text"`

Props

the <PText /> component takes the following props:

  • options -- an array of strings that may be used to auto-complete.
  • optionStyles -- a style object for every item in the recommendation list.
  • textStyles -- a style object for the textarea element.
  • wrapperStyles -- a style object for the wrapper div.
  • optionColor -- a string representing the color a hovered item will be colored.
  • onSelect -- a function to be called when an item is selected.

Example:

<PText 

  options={[
    'Macao',
    'Macedonia, The Former Yugoslav Republic of',
    'Madagascar', 
    'Malawi',
    'Malaysia',
    'Maldives', 
    'Mali',
    'Malta',
    'Marshall Islands',
    'Martinique',
    'Mauritania', 
    'Mauritius',
    'Mayotte', 
    'Mexico',
    'Micronesia, Federated States of', 
    'Moldova, Republic of',
    'Monaco',
    'Mongolia',
    'Montserrat',
    'Morocco',
    'Mozambique',
    'Myanmar'
  ]} 

  onSelect={(country) => alert(country)}
  optionColor={'#95C8D8'}
  wrapperStyles={{
    padding: '20px'
  }}
/>
1.2.7

6 years ago

1.2.6

6 years ago

1.2.5

6 years ago

1.2.4

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago