Debian Codegraph @

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

raw
1 ---
2 id: Text input group
3 section: components
4 cssPrefix: pf-v6-c-text-input-group
5 propComponents: ['TextInputGroup', 'TextInputGroupMain', 'TextInputGroupUtilities']
6 ---
7
8 import { useState } from 'react';
9 import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
10 import RhMicronsCloseIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-close-icon';
11
12 ## Examples
13
14 ### Basic text input group
15
16 A basic text input group updates its contents as users enter text.
17
18 ```ts file="./TextInputGroupBasic.tsx"
19
20 ```
21
22 ### Disabled text input group
23
24 To prevent users from making edits to a text input group, you can disable it using `isDisabled`.
25
26 ```ts file="./TextInputGroupDisabled.tsx"
27
28 ```
29
30 ### With icon and utilities
31
32 To help users identify the purpose of an input group, you can add an icon. To do this, import your icon and pass it to `icon` within `<TextInputGroupMain>`.
33
34 You can also add additional actions or utilities via `<TextInputGroupUtilities>`. The following example includes a clear button that allows users to remove their previous input.
35
36 ```ts file="./TextInputGroupUtilitiesAndIcon.tsx"
37
38 ```
39
40 ### With validation
41
42 You can add a validation status to a `<TextInputGroup>` by passing the `validated` property with a value of either "success", "warning", or "error".
43
44 ```ts file="./TextInputGroupWithStatus.tsx"
45
46 ```
47
48 ### With filters
49
50 When a text input group is used within a data view, like a table, you can nest filter labels within the group. To do this, pass a `<LabelGroup>` to `<TextInputGroupMain>`, with all of the labels that a user has selected. Users can interact with these labels as needed.
51
52 ```ts file="./TextInputGroupFilters.tsx"
53
54 ```