1 | # Terra Search Field
|
2 |
|
3 | A search component with a field that automatically performs a search callback after user input.
|
4 |
|
5 | ## Getting Started
|
6 |
|
7 | - Install with [npmjs](https://www.npmjs.com):
|
8 | - `npm install terra-search-field`
|
9 |
|
10 |
|
11 | ## Peer Dependencies
|
12 |
|
13 | <details>
|
14 | <summary>View information on this component's peer dependencies.</summary>
|
15 |
|
16 | This component requires the following peer dependencies be installed in your app for the component to properly function.
|
17 |
|
18 | | Peer Dependency | Version |
|
19 | |-|-|
|
20 | | react | ^16.8.5 |
|
21 | | react-dom | ^16.8.5 |
|
22 | | react-intl | ^2.8.0 |
|
23 |
|
24 |
|
25 | </details>
|
26 |
|
27 |
|
28 | ## Implementation Notes:
|
29 |
|
30 | The Searach-Field component must be composed inside the [Base][1] component with a locale in order for it to load the correct translation strings.
|
31 |
|
32 | [1]: https://github.com/cerner/terra-core/tree/master/packages/terra-base/docs
|
33 |
|
34 | ## Usage
|
35 |
|
36 | ```jsx
|
37 | import React from 'react';
|
38 | import SearchField from 'terra-search-field';
|
39 |
|
40 | // Search Field with placeholder
|
41 | <SearchField placeholder="Search" />
|
42 |
|
43 | // Search Field with callback function and delay
|
44 | <SearchField searchDelay={500} onSearch={(searchText) => { console.log(searchText); }} />
|
45 |
|
46 | // Search Field with callback function and minimum search text length
|
47 | <SearchField minimumSearchTextLength={5} onSearch={(searchText) => { console.log(searchText); }} />
|
48 |
|
49 | ```
|
50 |
|
51 | ## Component Features
|
52 | * [Cross-Browser Support](https://github.com/cerner/terra-ui/blob/master/src/terra-dev-site/contributing/ComponentStandards.e.contributing.md#cross-browser-support)
|
53 | * [Responsive Support](https://github.com/cerner/terra-ui/blob/master/src/terra-dev-site/contributing/ComponentStandards.e.contributing.md#responsive-support)
|
54 | * [Mobile Support](https://github.com/cerner/terra-ui/blob/master/src/terra-dev-site/contributing/ComponentStandards.e.contributing.md#mobile-support)
|