0.1.3 • Published 1 year ago

react-selector-input v0.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react-selector-input

npm license

a React input component with selector and filter

Advantages

  • Offer preset labels for users to input content
    Add a selector to a regular input box.Users can not only input content manually, but also select preset labels.
  • Search options according to highlighted input keywords
    When users input content,react-selector-input can filter the labels in the selector based on keywords.Those keywords will also be highlighted with different color in the selector.
  • Provide customized css style
    Users can determine the size of components according to their own needs.

Basic Usage

Installation

npm i react-selector-input

Import

import SelectInput from "react-selector-input";

Usage

function Example(){
    const options = [
        {
            label:'test1'
        },
        {
            label:'test2'
        },
        {
            label:'test3'
        },
        {
            label:'test4'
        },
    ]
    const  onChange = (e) => {
        console.log(e.target.value);
    }
    return (
        <div style={{display:'flex',justifyContent:'center',paddingTop:'200px'}}>
          <SelectInput placeholder={'placeholder'} width={'150px'} options={options} onChange={onChange} showClear />
        </div>

    );
}

API

PropertyTypeDefaultDescription
placeholderstring-Placeholder in input box
onChangefunction-Callback function when input content is changed
widthstring'150px'Width of the input box
showClearbooleanfalseWhether show delete button which can remove the input content
disabledbooleanfalseWhether the input is disabled
defaultValuestring-Default value of the input box
options{label}[]-Content of select list
listHeightstringautoHeight of select list
inputPaddingstring'6px 20px 6px 10px'Padding of input box
listPaddingstring'6px'Padding of select list
inputFontSizestring'14px'Fontsize of input box
listFontSizestring'14px'Fontsize of select list
0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago