node/@patternfly/react-core/src/components/SearchInput/examples/SearchInputBasic.tsx
raw| 1 | import { useState } from 'react'; |
| 2 | import { SearchInput } from '@patternfly/react-core'; |
| 3 | |
| 4 | export const SearchInputBasic: React.FunctionComponent = () => { |
| 5 | const [value, setValue] = useState(''); |
| 6 | |
| 7 | const onChange = (value: string) => { |
| 8 | setValue(value); |
| 9 | }; |
| 10 | |
| 11 | return ( |
| 12 | <SearchInput |
| 13 | aria-label="Search basic example" |
| 14 | placeholder="Find by name" |
| 15 | value={value} |
| 16 | onChange={(_event, value) => onChange(value)} |
| 17 | onClear={() => onChange('')} |
| 18 | /> |
| 19 | ); |
| 20 | }; |