> ## Documentation Index
> Fetch the complete documentation index at: https://api.fanvue.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# TextField

> A text input field with optional label, helper/error text, icon slots, and side labels.

```tsx theme={null}
import { TextField } from "@fanvue/ui";
import type { TextFieldProps, TextFieldSize } from "@fanvue/ui";
```

## Examples

## Default

<Frame>
  <iframe src={"https://main--697a1b6dd4dad73ee9c0e5f5.chromatic.com/iframe.html?id=components-textfield--default&viewMode=story&shortcuts=false&singleStory=true&globals=theme:light"} width="100%" height="240" style={{border: "none", borderRadius: "8px"}} loading="lazy" title="TextField — Default" />
</Frame>

```tsx theme={null}
import { TextField } from "@fanvue/ui";

<TextField label="Label" placeholder="Placeholder Text" />
```

## Error Without Message

<Frame>
  <iframe src={"https://main--697a1b6dd4dad73ee9c0e5f5.chromatic.com/iframe.html?id=components-textfield--error-without-message&viewMode=story&shortcuts=false&singleStory=true&globals=theme:light"} width="100%" height="240" style={{border: "none", borderRadius: "8px"}} loading="lazy" title="TextField — Error Without Message" />
</Frame>

```tsx theme={null}
import { TextField } from "@fanvue/ui";

<TextField
  label="Username"
  placeholder="Enter username"
  error
  helperText="This field is required"
  defaultValue=""
/>
```

## Side Label (all sizes)

<Frame>
  <iframe src={"https://main--697a1b6dd4dad73ee9c0e5f5.chromatic.com/iframe.html?id=components-textfield--side-label-sizes&viewMode=story&shortcuts=false&singleStory=true&globals=theme:light"} width="100%" height="240" style={{border: "none", borderRadius: "8px"}} loading="lazy" title="TextField — Side Label (all sizes)" />
</Frame>

```tsx theme={null}
import { TextField } from "@fanvue/ui";

<div className="flex w-[375px] flex-col gap-4">
  <TextField size="48" label="Size 48" leftLabel="$" rightLabel="USD" placeholder="0.00" />
  <TextField size="40" label="Size 40" leftLabel="$" rightLabel="USD" placeholder="0.00" />
  <TextField size="32" label="Size 32" leftLabel="$" rightLabel="USD" placeholder="0.00" />
</div>
```

## Without Label

<Frame>
  <iframe src={"https://main--697a1b6dd4dad73ee9c0e5f5.chromatic.com/iframe.html?id=components-textfield--without-label&viewMode=story&shortcuts=false&singleStory=true&globals=theme:light"} width="100%" height="240" style={{border: "none", borderRadius: "8px"}} loading="lazy" title="TextField — Without Label" />
</Frame>

```tsx theme={null}
import { TextField } from "@fanvue/ui";

<TextField placeholder="No label" aria-label="Search" />
```

## All States

<Frame>
  <iframe src={"https://main--697a1b6dd4dad73ee9c0e5f5.chromatic.com/iframe.html?id=components-textfield--all-states&viewMode=story&shortcuts=false&singleStory=true&globals=theme:light"} width="100%" height="240" style={{border: "none", borderRadius: "8px"}} loading="lazy" title="TextField — All States" />
</Frame>

```tsx theme={null}
import { HomeIcon, InfoCircleIcon, TextField } from "@fanvue/ui";

<div className="flex w-[375px] flex-col gap-6">
  <TextField label="Default" placeholder="Placeholder" />
  <TextField label="With helper" placeholder="Placeholder" helperText="Helper text" />
  <TextField label="With value" defaultValue="Typed text" />
  <TextField label="Validated" validated defaultValue="user@example.com" />
  <TextField label="Error" error errorMessage="Error message" defaultValue="invalid" />
  <TextField label="Disabled" placeholder="Placeholder" disabled />
  <TextField label="Disabled with value" defaultValue="Value" disabled />
  <TextField label="Left icon" placeholder="Placeholder" leftIcon={<HomeIcon />} />
  <TextField label="Right icon" placeholder="Placeholder" rightIcon={<InfoCircleIcon />} />
  <TextField
    label="Both icons"
    placeholder="Placeholder"
    leftIcon={<HomeIcon />}
    rightIcon={<InfoCircleIcon />}
  />
</div>
```

## Props

## TextField

A text input field with optional label, helper/error text, icon slots, and side labels.

Use `leftLabel` / `rightLabel` for fixed unit or prefix affordances (currency symbol, country code, domain suffix). Provide at least one of `label`, `aria-label`, or `aria-labelledby` for accessibility — a console warning is emitted in development if none are set.

<ParamField path="action" type="ReactNode">
  Trailing interactive element pinned to the right edge — typically a `Chip` or `Button` (the "with button" field type). Reduces the right padding so the control sits flush, and clicks on it do not steal focus from the input.
</ParamField>

<ParamField path="error" type="boolean" default="false">
  Whether the text field is in an error state.
</ParamField>

<ParamField path="errorMessage" type="string">
  Error message displayed below the input. Shown instead of `helperText` when `error` is `true`.
</ParamField>

<ParamField path="fullWidth" type="boolean" default="false">
  Whether the text field stretches to fill its container width.
</ParamField>

<ParamField path="helperText" type="string">
  Helper text displayed below the input. Replaced by `errorMessage` when `error` is `true`.
</ParamField>

<ParamField path="label" type="string">
  Label text displayed above the input. Also used as the accessible name.
</ParamField>

<ParamField path="leftIcon" type="ReactNode">
  Icon element displayed at the left side of the input.
</ParamField>

<ParamField path="leftLabel" type="ReactNode">
  Fixed, non-editable label pinned inside the left edge of the field — for a prefix such as a currency symbol or country code.
</ParamField>

<ParamField path="rightIcon" type="ReactNode">
  Icon element displayed at the right side of the input.
</ParamField>

<ParamField path="rightLabel" type="ReactNode">
  Fixed, non-editable label pinned inside the right edge of the field — for a unit or suffix such as a currency code or domain.
</ParamField>

<ParamField path="size" type="&#x22;32&#x22; | &#x22;40&#x22; | &#x22;48&#x22;" default="48">
  Height of the text field in pixels.
</ParamField>

<ParamField path="validated" type="boolean" default="false">
  Whether the text field is validated.
</ParamField>

## Exported types

Also exported from `@fanvue/ui`: `TextFieldProps`, `TextFieldSize`.

***

**Setup:** [Installation](/docs/ui/installation) · [Theming](/docs/ui/theming)
