13 lines
685 B
JavaScript
13 lines
685 B
JavaScript
import CreatableSelect from 'react-select/creatable';
|
|
|
|
import { useState } from 'react'
|
|
|
|
export default function Input({ options, value, setValue, onCreateOption, id, label, className, placeholder=null, isMulti=false}) {
|
|
|
|
return (
|
|
<div className={"relative flex flex-col" + " " + className}>
|
|
<label className="pr-3 pb-0.5">{ label }</label>
|
|
<CreatableSelect isClearable value={ value } onChange={(newValue) => setValue(newValue)} onCreateOption={(e) => onCreateOption(e) } formatCreateLabel={(inputValue) => "ایجاد " + label + ' "' + inputValue + '"'} placeholder={placeholder} options={options} isMulti={isMulti}/>
|
|
</div>
|
|
);
|
|
} |