Debian Codegraph @

node/@patternfly/react-core/src/components/SearchInput/examples/SearchInputWithResultCount.tsx

raw
1 import { useState } from 'react';
2 import { SearchInput } from '@patternfly/react-core';
3
4 export const SearchInputWithResultCount: React.FunctionComponent = () => {
5 const [value, setValue] = useState('');
6 const [resultsCount, setResultsCount] = useState(0);
7
8 const onChange = (value: string) => {
9 setValue(value);
10 setResultsCount(3);
11 };
12
13 const onClear = () => {
14 setValue('');
15 setResultsCount(0);
16 };
17
18 return (
19 <SearchInput
20 aria-label="Match with result count"
21 placeholder="Find by name"
22 value={value}
23 onChange={(_event, value) => onChange(value)}
24 onClear={onClear}
25 resultsCount={resultsCount}
26 />
27 );
28 };