| 1 |
--- |
| 2 |
id: Text input |
| 3 |
section: components |
| 4 |
subsection: forms |
| 5 |
cssPrefix: pf-v6-c-form-control |
| 6 |
propComponents: ['TextInput', 'TextInputExpandedObj'] |
| 7 |
--- |
| 8 |
|
| 9 |
import { useRef, useState } from 'react'; |
| 10 |
import RhUiCalendarFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-calendar-fill-icon'; |
| 11 |
import RhUiClockFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-clock-fill-icon'; |
| 12 |
|
| 13 |
## Examples |
| 14 |
|
| 15 |
### Basic |
| 16 |
|
| 17 |
```ts file="./TextInputBasic.tsx" |
| 18 |
|
| 19 |
``` |
| 20 |
|
| 21 |
### Disabled |
| 22 |
|
| 23 |
```ts file="./TextInputDisabled.tsx" |
| 24 |
|
| 25 |
``` |
| 26 |
|
| 27 |
### Truncated at start |
| 28 |
|
| 29 |
```ts file="./TextInputStartTruncated.tsx" |
| 30 |
|
| 31 |
``` |
| 32 |
|
| 33 |
### Read only |
| 34 |
|
| 35 |
```ts file="./TextInputReadOnly.tsx" |
| 36 |
|
| 37 |
``` |
| 38 |
|
| 39 |
### Invalid |
| 40 |
|
| 41 |
```ts file="./TextInputInvalid.tsx" |
| 42 |
|
| 43 |
``` |
| 44 |
|
| 45 |
### Select text using ref |
| 46 |
|
| 47 |
```ts file="./TextInputSelectUsingRef.tsx" |
| 48 |
|
| 49 |
``` |
| 50 |
|
| 51 |
### Custom icon |
| 52 |
|
| 53 |
```ts file="./TextInputCustomIcon.tsx" |
| 54 |
|
| 55 |
``` |
| 56 |
|
| 57 |
### Custom icon and invalid |
| 58 |
|
| 59 |
```ts file="./TextInputCustomIconInvalid.tsx" |
| 60 |
|
| 61 |
``` |