-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Dropdown): add
searchQuery
prop (#2109)
- Loading branch information
1 parent
da8e686
commit e056cd6
Showing
5 changed files
with
80 additions
and
5 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
docs/app/Examples/modules/Dropdown/Usage/DropdownExampleSearchQuery.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React, { Component } from 'react' | ||
import { Dropdown } from 'semantic-ui-react' | ||
|
||
import { stateOptions } from '../common' | ||
// stateOptions = [ { key: 'AL', value: 'AL', text: 'Alabama' }, ... ] | ||
|
||
export default class DropdownExampleSearchQuery extends Component { | ||
state = { searchQuery: '' } | ||
|
||
handleChange = (e, { value }) => this.setState({ | ||
value, | ||
searchQuery: '', | ||
}) | ||
|
||
handleSearchChange = (e, searchQuery) => this.setState({ searchQuery }) | ||
|
||
render() { | ||
const { searchQuery, value } = this.state | ||
|
||
return ( | ||
<Dropdown | ||
fluid | ||
multiple | ||
onChange={this.handleChange} | ||
onSearchChange={this.handleSearchChange} | ||
options={stateOptions} | ||
placeholder='State' | ||
search | ||
searchQuery={searchQuery} | ||
selection | ||
value={value} | ||
/> | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters