1.0.2 • Published 4 years ago

reacthook-simple-select v1.0.2

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

reacthook-simple-select

Installation:

$ npm install --save reacthook-simple-select

Options

optionDescriptionExample
selecteddefault selected value'option1', 'option2'
optionsdata{ name: 'Option 1', value: 'option1'},...
filterEnable filteringdefault: false
multipleEnable multiple choicedefault: false
placeholderPlaceholder of selectdefault: 'Chọn'
placeholderSearchPlaceholder of filterdefault: 'Tìm kiếm ...'
smallsize smalldefault: fasle

Usage:

import React, { useEffect, useState, useRef } from 'react';
import Select from 'react-simple-select'
export default function Component() {
    const [selected, setSelected] = useState(['2020']);
    render (<Select options={[{name: '2020', value: '2020'},{name: '2019', value: '2019'}]}
                placeholder="--Years--"
                selected={selected}
                multiple={false}
                filter={true}
                placeholderSearch="Search ..."
                onChange={value => {console.log(value)} />)
}