Debian Codegraph @

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

raw
1 ---
2 id: 'Search input'
3 section: components
4 cssPrefix: 'pf-v6-c-search-input'
5 propComponents: ['SearchInput', 'SearchInputSearchAttribute', 'SearchInputExpandable']
6 ---
7
8 import { useRef, useState } from 'react';
9 import RhUiExternalLinkFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-external-link-fill-icon';
10
11 ## Examples
12
13 ### Basic
14
15 ```ts file='./SearchInputBasic.tsx'
16
17 ```
18
19 ### Match with result count
20
21 ```ts file='./SearchInputWithResultCount.tsx'
22
23 ```
24
25 ### Match with navigable options
26
27 ```ts file='./SearchInputWithNavigableOptions.tsx'
28
29 ```
30
31 ### With submit button
32
33 ```ts file='./SearchInputWithSubmitButton.tsx'
34
35 ```
36
37 ### Focus search input using ref
38
39 ```ts file='./SearchInputFocusSearch.tsx'
40
41 ```
42
43 ### With expandable button
44
45 Animations on the expansion and collapse of the search input may be opted into by passing `hasAnimations` to the `expandableInput` object.
46
47 ```ts file='./SearchInputWithExpandable.tsx'
48
49 ```
50
51 ### Advanced
52
53 The search input component can be used to dynamically build a one to one attribute-value advanced search.
54 Using the `attributes` prop alongside the `advancedSearchDelimiter` will expose this functionality, as demonstrated in
55 the following example. The search input component can also be used as a composable component and paired with a Popper
56 or other elements to build a completely custom advanced search form. This feature is demonstrated
57 in the search input's <a href="/components/search-input/react-demos">react demos</a>.
58
59 The values used in the attribute-value form fields may contain spaces. The values containing spaces
60 should be wrapped with quotes inside the summary search string in the input field. If the latter is
61 autogenerated from the individual fields the quotes will be autoplaced.
62
63 ```ts file='./SearchInputAdvanced.tsx'
64
65 ```