How do I get the Materialize select dropdown to work with React?

user3006381 picture user3006381 · Mar 31, 2016 · Viewed 10.6k times · Source

Adding the following template code provided by Materialize doesn't immediately work in a React component:

<div class="input-field col s12">
  <select>
    <option value="" disabled selected>Choose your option</option>
    <option value="1">Option 1</option>
    <option value="2">Option 2</option>
    <option value="3">Option 3</option>
  </select>
  <label>Materialize Select</label>
</div>

How do fix this so that the select dropdown works?

Answer

dealwap picture dealwap · Dec 4, 2017

The solution to this is to use browser default as the class name.

<div class="input-field col s12">
  <select className="browser-default">
    <option value="" disabled selected>Choose your option</option>
    <option value="1">Option 1</option>
    <option value="2">Option 2</option>
    <option value="3">Option 3</option>
  </select>
  <label>Materialize Select</label>
</div>