# @salmonui/inputs/text-field API reference

> 6 exported symbols of @salmonui/inputs/text-field: 2 components, 3 interfaces and 1 type.

Canonical: https://salmonui.dev/docs/reference/inputs/text-field

```ts
import { … } from '@salmonui/inputs/text-field';
```

## Components

### TextArea

Kind: component

Page: https://salmonui.dev/docs/reference/inputs/text-field/TextArea

```ts
function TextArea(props: TextAreaProps): ReactNode;
```

Multi-line text input (TextBox `multiline`): a native
`<textarea>`. `ref` is the textarea.

Props: [`TextAreaProps`](https://salmonui.dev/docs/reference/inputs/text-field/TextAreaProps) (its members are the props)

### TextField

Kind: component

Page: https://salmonui.dev/docs/reference/inputs/text-field/TextField

```ts
function TextField(props: TextFieldProps): ReactNode;
```

Single-line text input: a native `<input>` with label,
description, validation, adornments and an optional clear button. `ref` is
the input; unknown props go to the input, `className` / `style` to the root.

Props: [`TextFieldProps`](https://salmonui.dev/docs/reference/inputs/text-field/TextFieldProps) (its members are the props)

## Interfaces

### TextAreaProps

Kind: interface

Page: https://salmonui.dev/docs/reference/inputs/text-field/TextAreaProps

```ts
interface TextAreaProps extends TextBaseProps, NativeTextArea {
    readonly resize?: 'vertical' | 'horizontal' | 'both' | 'none' | undefined;
    readonly autoResize?: boolean | undefined;
    readonly ref?: Ref<HTMLTextAreaElement> | undefined;
}
```

Members (20):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `label` | `label?: ReactNode;` | optional, inherited |  |
| `description` | `description?: ReactNode;` | optional, inherited |  |
| `errorMessage` | `errorMessage?: ((ctx: { readonly errors: readonly string[]; }) => ReactNode) \| ReactNode;` | optional, inherited | Error text (or a function of the errors) shown while the field is invalid. |
| `invalid` | `invalid?: boolean;` | optional, inherited | Forces the error state. |
| `resize` | `readonly resize?: 'vertical' \| 'horizontal' \| 'both' \| 'none' \| undefined;` | optional | Native resize handle. Default `'both'`. |
| `autoResize` | `readonly autoResize?: boolean \| undefined;` | optional | Grows with its content: `field-sizing: content`, one `scrollHeight` read per input where unsupported. |
| `ref` | `readonly ref?: Ref<HTMLTextAreaElement> \| undefined;` | optional | The native `<textarea>`. |
| `validation` | `validation?: FieldValidation;` | optional, inherited | Rules in the Data Grid vocabulary. |
| `validateOn` | `validateOn?: ValidateOn;` | optional, inherited | When errors appear; default the `Form`'s, else `'blur'`. |
| `size` | `size?: FieldSize;` | optional, inherited | Metric set. Default `'md'`. |
| `value` | `value?: string;` | optional, inherited |  |
| `defaultValue` | `defaultValue?: string;` | optional, inherited |  |
| `onValueChange` | `onValueChange?: ((value: string, details: TextChangeDetails) => void);` | optional, inherited |  |
| `clearable` | `clearable?: boolean;` | optional, inherited | Shows a clear button while there is a value; Escape clears too. |
| `startAdornment` | `startAdornment?: ReactNode;` | optional, inherited |  |
| `endAdornment` | `endAdornment?: ReactNode;` | optional, inherited |  |
| `localeText` | `localeText?: TextFieldLocaleText;` | optional, inherited |  |
| `className` | `className?: string;` | optional, inherited | Root class and style (the input gets every other prop). |
| `style` | `style?: CSSProperties;` | optional, inherited |  |
| `classNames` | `classNames?: { readonly group?: string; readonly input?: string; readonly label?: string; readonly description?: string; readonly error?: string; };` | optional, inherited | Part classes: `root` is `className`; `group`, `input`, `label`, `description`, `error`. |

### TextChangeDetails

Kind: interface

Page: https://salmonui.dev/docs/reference/inputs/text-field/TextChangeDetails

```ts
interface TextChangeDetails {
    readonly source: 'keyboard' | 'pointer' | 'api';
    readonly reason: 'input' | 'clear' | 'reset';
}
```

Second argument of `onValueChange`.

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `source` | `readonly source: 'keyboard' \| 'pointer' \| 'api';` |  |  |
| `reason` | `readonly reason: 'input' \| 'clear' \| 'reset';` |  | `'input'` typing or paste, `'clear'` clear button or Escape, `'reset'` form reset. |

### TextFieldProps

Kind: interface

Page: https://salmonui.dev/docs/reference/inputs/text-field/TextFieldProps

```ts
interface TextFieldProps extends TextBaseProps, NativeInput {
    readonly type?: 'text' | 'password' | 'email' | 'tel' | 'url' | 'search' | undefined;
    readonly ref?: Ref<HTMLInputElement> | undefined;
}
```

Members (19):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `type` | `readonly type?: 'text' \| 'password' \| 'email' \| 'tel' \| 'url' \| 'search' \| undefined;` | optional | Input type; numbers use `NumberField`. Default `'text'`. |
| `ref` | `readonly ref?: Ref<HTMLInputElement> \| undefined;` | optional | The native `<input>`. |
| `label` | `label?: ReactNode;` | optional, inherited |  |
| `description` | `description?: ReactNode;` | optional, inherited |  |
| `errorMessage` | `errorMessage?: ((ctx: { readonly errors: readonly string[]; }) => ReactNode) \| ReactNode;` | optional, inherited | Error text (or a function of the errors) shown while the field is invalid. |
| `invalid` | `invalid?: boolean;` | optional, inherited | Forces the error state. |
| `validation` | `validation?: FieldValidation;` | optional, inherited | Rules in the Data Grid vocabulary. |
| `validateOn` | `validateOn?: ValidateOn;` | optional, inherited | When errors appear; default the `Form`'s, else `'blur'`. |
| `size` | `size?: FieldSize;` | optional, inherited | Metric set. Default `'md'`. |
| `value` | `value?: string;` | optional, inherited |  |
| `defaultValue` | `defaultValue?: string;` | optional, inherited |  |
| `onValueChange` | `onValueChange?: ((value: string, details: TextChangeDetails) => void);` | optional, inherited |  |
| `clearable` | `clearable?: boolean;` | optional, inherited | Shows a clear button while there is a value; Escape clears too. |
| `startAdornment` | `startAdornment?: ReactNode;` | optional, inherited |  |
| `endAdornment` | `endAdornment?: ReactNode;` | optional, inherited |  |
| `localeText` | `localeText?: TextFieldLocaleText;` | optional, inherited |  |
| `className` | `className?: string;` | optional, inherited | Root class and style (the input gets every other prop). |
| `style` | `style?: CSSProperties;` | optional, inherited |  |
| `classNames` | `classNames?: { readonly group?: string; readonly input?: string; readonly label?: string; readonly description?: string; readonly error?: string; };` | optional, inherited | Part classes: `root` is `className`; `group`, `input`, `label`, `description`, `error`. |

## Types

### TextFieldLocaleText

Kind: type

Page: https://salmonui.dev/docs/reference/inputs/text-field/TextFieldLocaleText

```ts
type TextFieldLocaleText = FieldValidationText & {
    readonly clear?: string;
};
```

User-visible strings: `clear` names the clear button; `validation*` keys override rule messages.

Members (18):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `validationCreditcard` | `validationCreditcard?: string;` | optional, inherited |  |
| `validationDate` | `validationDate?: string;` | optional, inherited |  |
| `validationDateIso` | `validationDateIso?: string;` | optional, inherited |  |
| `validationDigits` | `validationDigits?: string;` | optional, inherited |  |
| `validationEmail` | `validationEmail?: string;` | optional, inherited |  |
| `validationMax` | `validationMax?: string;` | optional, inherited |  |
| `validationMaxLength` | `validationMaxLength?: string;` | optional, inherited |  |
| `validationMin` | `validationMin?: string;` | optional, inherited |  |
| `validationMinLength` | `validationMinLength?: string;` | optional, inherited |  |
| `validationNumber` | `validationNumber?: string;` | optional, inherited |  |
| `validationPattern` | `validationPattern?: string;` | optional, inherited |  |
| `validationRange` | `validationRange?: string;` | optional, inherited |  |
| `validationRangeLength` | `validationRangeLength?: string;` | optional, inherited |  |
| `validationRequired` | `validationRequired?: string;` | optional, inherited |  |
| `validationTel` | `validationTel?: string;` | optional, inherited |  |
| `validationUrl` | `validationUrl?: string;` | optional, inherited |  |
| `validationValidate` | `validationValidate?: string;` | optional, inherited |  |
| `clear` | `clear?: string;` | optional, inherited |  |
