This content originally appeared on DEV Community and was authored by Aya Bouchiha
Hi, I'm Aya Bouchiha, on this awesome day, we'll talk about react-select.
react-select
react-select: is a react library that lets you build easily an awesome select box or drop-down menu.
installation
npm i react-select
yarn add react-select
Code
import Select from 'react-select';
const options = [
{ value: 'ar', label: 'arabic' }
{ value: 'en', label: 'english' },
{ value: 'fr', label: 'french' },
]
const SelectBox = () => {
return (
<>
<Select
name="name"
className="basic-single"
classNamePrefix="select"
isDisabled={false}
isLoading={true}
isClearable={true}
isRtl={true}
isSearchable={true}
defaultValue={options[0]} // default option
options={options} // options
/>
</>
);
}
export default SelectBox;
Have an amazing day!
This content originally appeared on DEV Community and was authored by Aya Bouchiha
Aya Bouchiha | Sciencx (2021-09-04T21:49:27+00:00) Building An Awesome Select Box Using “react-select” library. Retrieved from https://www.scien.cx/2021/09/04/building-an-awesome-select-box-using-react-select-library/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.