ablbol
ablbol

Reputation: 11

Is there Select Field in Material UI version 1?

I am new to Material UI and am trying to use V1. Is there Select Field in V1. I can't find it. Is it replaced by something else? Thanks

Upvotes: 1

Views: 1178

Answers (2)

Orkun
Orkun

Reputation: 7248

As of material V1.2 :

import Select from '@material-ui/core/Select';

...

          <Select
            value={this.state.age}
            onChange={this.handleChange}
            inputProps={{
              name: 'age',
              id: 'age-simple',
            }}
          >
            <MenuItem value="">
              <em>None</em>
            </MenuItem>
            <MenuItem value={10}>Ten</MenuItem>
            <MenuItem value={20}>Twenty</MenuItem>
            <MenuItem value={30}>Thirty</MenuItem>
          </Select>

Upvotes: 2

trylimits
trylimits

Reputation: 2575

The SelectField component in Material UI v1 is currently work in progress. You can see the current progress here.

I recently ported some projects to Material UI v1 and replaced select fields with radio buttons.

Edit Since v1.0.0-beta.9 the Selectcomponent is available. Example usage:

  <Select
    value={this.state.value}
    onChange={(e) => this.setState({ value : event.target.value}) }
    input={<Input name="select" id="select-simple" />}
  >
    <MenuItem value={0}>
      <em>None</em>
    </MenuItem>
    <MenuItem value={10}>Ten</MenuItem>
    <MenuItem value={20}>Twenty</MenuItem>
    <MenuItem value={30}>Thirty</MenuItem>
  </Select>

Upvotes: 1

Related Questions