26

How to disable input on react-select? Is that possible? I just want it to be a dropdown.

<Select
    placeholder="Action"
    className="col-3 mt-3"
    value={orderStatusInput}
    onChange={this.onOrderStatusChange}
    options={orderStatusOptions}
/>

enter image description here

4
  • Title and description was misleading, I thought you wanted to disable the input. @AlexMcKay has correct answer. Commented Sep 18, 2020 at 3:21
  • 1
    @DrewReese way to misread the question and put it on OP Commented Sep 18, 2020 at 3:24
  • @AlexMckay "How to disable input on react-select?" isn't exactly an ambiguous question, and why would one assume a select component wasn't already a dropdown. 🤷🏻‍♂️ Commented Sep 18, 2020 at 3:32
  • 1
    '"How to disable input on react-select?" isn't exactly an ambiguous question' - so we agree then :) I think the fact that OP didn't say "Disable react-select", said he "just want(ed) it to be a dropdown" and also provided a screenshot with a cursor made it quite clear. I am not looking to attack you I just thought of all poorly asked questions on SO it was unfair to call out OP. Commented Sep 18, 2020 at 3:40

3 Answers 3

44

To make React Select act as a dropdown

export default function App() {
  return (
    <div>
      <ReactSelect isSearchable={false} />
    </div>
  );
}
Sign up to request clarification or add additional context in comments.

Comments

18

If you want the search input to be disabled and just want it to be a dropdown, you can set the isSearchable property to false:

<Select
  placeholder="Action"
  className="col-3 mt-3"
  value={orderStatusInput}
  onChange={this.onOrderStatusChange}
  options={orderStatusOptions}
  isSearchable={false}
/>

Comments

2

<Select isDisabled={true} />

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.