---
title: Text Field
description: A text input that allow users to input custom text entries with a keyboard.

link:
  doc: https://kobalte.dev/docs/core/components/text-field
  api: https://kobalte.dev/docs/core/components/text-field#api-reference
---

<ComponentPreview name="text-field-demo">

```tsx file=<rootDir>/apps/docs/src/registry/examples/text-field-demo.tsx

```

</ComponentPreview>

## Installation

<ComponentInstallation>

<Step>

<StepItem>Copy and paste the following code into your project:</StepItem>

  <ComponentSourceTabs>

    ```tsx title="components/ui/text-field" file=<rootDir>/apps/docs/src/registry/ui/text-field.tsx

    ```

    ```tsx title="components/ui/text-field" file=<rootDir>/apps/unocss-playground/src/registry/ui/text-field.tsx

    ```

  </ComponentSourceTabs>

</Step>

</ComponentInstallation>

## Usage

```tsx
import { TextField, TextFieldInput } from "@components/ui/text-field"
```

```tsx
<TextField>
  <TextFieldInput />
</TextField>
```

## Examples

### Disabled

<ComponentPreview name="text-field-disabled-demo">

```tsx file=<rootDir>/apps/docs/src/registry/examples/text-field-disabled-demo.tsx

```

</ComponentPreview>

### Error

<ComponentPreview name="text-field-error-demo">

```tsx file=<rootDir>/apps/docs/src/registry/examples/text-field-error-demo.tsx

```

</ComponentPreview>

### File

<ComponentPreview name="text-field-file-demo">

```tsx file=<rootDir>/apps/docs/src/registry/examples/text-field-file-demo.tsx

```

</ComponentPreview>

### Text Area

<ComponentPreview name="text-field-area-demo">

```tsx file=<rootDir>/apps/docs/src/registry/examples/text-field-area-demo.tsx

```

</ComponentPreview>

## Changelog

#### 2025-11-13 Update `<TextFieldErrorMessage />`

We've updated the `<TextFieldErrorMessage />` component to handle error messages more effectively and better integration with form libraries.
