| 1 |
--- |
| 2 |
id: Search input |
| 3 |
section: components |
| 4 |
--- |
| 5 |
import { useEffect, useRef, useState } from 'react'; |
| 6 |
import { |
| 7 |
Button, |
| 8 |
Card, |
| 9 |
CardBody, |
| 10 |
CardFooter, |
| 11 |
DatePicker, |
| 12 |
Form, |
| 13 |
FormGroup, |
| 14 |
Grid, |
| 15 |
GridItem, |
| 16 |
Menu, |
| 17 |
MenuContent, |
| 18 |
MenuItem, |
| 19 |
MenuList, |
| 20 |
MenuToggle, |
| 21 |
Popper, |
| 22 |
SearchInput, |
| 23 |
TextInput |
| 24 |
} from '@patternfly/react-core'; |
| 25 |
import { words } from './words.js'; |
| 26 |
|
| 27 |
## Demos |
| 28 |
|
| 29 |
### Search with autocomplete |
| 30 |
|
| 31 |
This demo handles building the advanced search form using the composable Menu, and the `SearchInput`'s `hint` prop. |
| 32 |
It also demonstrates wiring up the appropriate keyboard interactions, focus management, and general event handling. |
| 33 |
|
| 34 |
```ts file="examples/SearchInputAutocomplete.tsx" |
| 35 |
|
| 36 |
``` |
| 37 |
|
| 38 |
### Composable advanced search |
| 39 |
|
| 40 |
This demo handles building the advanced search form using the composable Menu, as well as wiring up a |
| 41 |
select using the composable Menu and MenuToggle components. This demo also demonstrates wiring up the appropriate |
| 42 |
keyboard interactions, focus management, and general event handling. |
| 43 |
|
| 44 |
Note: This demo and its handling of 'date within' and a date picker is modeled after the gmail advanced search form. |
| 45 |
|
| 46 |
```ts file="examples/SearchInputAdvancedComposable.tsx" |
| 47 |
|
| 48 |
``` |