Skip to content

Commit

Permalink
[docs] Document how to use the Select with a label and a placeholder (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Jul 31, 2018
1 parent dde9d44 commit d89cf80
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/src/pages/demos/selects/NativeSelects.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,22 @@ class NativeSelects extends React.Component {
</NativeSelect>
<FormHelperText>Without label</FormHelperText>
</FormControl>
<FormControl className={classes.formControl}>
<InputLabel shrink htmlFor="age-native-label-placeholder">
Age
</InputLabel>
<NativeSelect
value={this.state.age}
onChange={this.handleChange('age')}
input={<Input name="age" id="age-native-label-placeholder" />}
>
<option value="">None</option>
<option value={10}>Ten</option>
<option value={20}>Twenty</option>
<option value={30}>Thirty</option>
</NativeSelect>
<FormHelperText>Label + placeholder</FormHelperText>
</FormControl>
<FormControl className={classes.formControl} disabled>
<InputLabel htmlFor="name-native-disabled">Name</InputLabel>
<NativeSelect
Expand Down
21 changes: 21 additions & 0 deletions docs/src/pages/demos/selects/SimpleSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,27 @@ class SimpleSelect extends React.Component {
</Select>
<FormHelperText>Without label</FormHelperText>
</FormControl>
<FormControl className={classes.formControl}>
<InputLabel shrink htmlFor="age-label-placeholder">
Age
</InputLabel>
<Select
value={this.state.age}
onChange={this.handleChange}
input={<Input name="age" id="age-label-placeholder" />}
displayEmpty
name="age"
className={classes.selectEmpty}
>
<MenuItem value="">
<em>None</em>
</MenuItem>
<MenuItem value={10}>Ten</MenuItem>
<MenuItem value={20}>Twenty</MenuItem>
<MenuItem value={30}>Thirty</MenuItem>
</Select>
<FormHelperText>Label + placeholder</FormHelperText>
</FormControl>
<FormControl className={classes.formControl} disabled>
<InputLabel htmlFor="name-disabled">Name</InputLabel>
<Select
Expand Down

0 comments on commit d89cf80

Please sign in to comment.