분류 Reactjs

React을 위한 경량 선택 구성 요소

컨텐츠 정보

  • 조회 424 (작성일 )

본문

npm (npm install react-select-search --save)으로 설치하고 평소와 같이 가져옵니다.



http://tbleckert.github.io/react-select-search/ 

https://github.com/tbleckert/react-select-search 


Demo 


import SelectSearch from 'react-select-search';

/**
 * The options array should contain objects.
 * Required keys are "name" and "value" but you can have and use any number of key/value pairs.
 */
const options = [
    {name: 'Swedish', value: 'sv'},
    {name: 'English', value: 'en'},
    {
        type: 'group',
        name: 'Group name',
        items: [
            {name: 'Spanish', value: 'es'},
        ]
    },
];

/* Simple example */
<SelectSearch options={options} defaultValue="sv" name="language" placeholder="Choose your language" />