0

How to make a fixed options in react select i dont seem to understand their documentation on how the thing work

Here's what i wanted in react-select

React-Select Fixed Option

This is my form with react select i want to fix the CONNECT option i also set the isFixed to false except for the CONNECT options

This is my form

Here's my Code

This is my fetched data i also set the isFixed value to false except in CONNECT

async function fetched_roles() {
  const response = await axios.get("/rmsroles");
  let newresponse = response !== null && 
  (response.data).map((role) => (
    role.role == 'CONNECT' ?
    { value : role.role , label : role.role , isFixed: 'true' }
    :
    { value : role.role , label : role.role , isFixed: 'false' }
    ))
  setIsLoading(false);
  setRoles(newresponse);
}
fetched_roles();
 }, []);

This is the react-select component

 <Select
   name="roles"
   onChange={handleGetRoles}
   isMulti
   isLoading={isLoading}
   options={roles}
   components={animatedComponents}
  />

1 Answers1

0

I believe it is called multiple select. There is a similar question here: HTML: Select multiple as dropdown.

You can also use other library like React-Select