Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React-Select drop-down menu change default text

I am currently using React-Select to create a dropdown menu. It's pretty simple code:

<Select className="dropdown" value={this.state.selectedOption} 
 options={this.state.options} onChange={this.handleQueryDropdown.bind(this)}/>

Which produces this:

The React-Select Dropdown

My Question: Is it possible to change the "Select..." to a different message? I searched on stack and the api, but couldn't find any examples.

Thanks!

like image 373
lve Avatar asked Oct 31 '25 16:10

lve


1 Answers

Use: placeholder property.

  <Select
    className="dropdown"
    value={this.state.selectedOption} 
    options={this.state.options}
    onChange={this.handleQueryDropdown.bind(this)}
    placeholder='Any String You Want'
  />

From: props

like image 126
Sultan H. Avatar answered Nov 02 '25 06:11

Sultan H.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!