> ## 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.

# SearchField

> A text input field with a search icon and optional clear button.

```tsx theme={null}
import { SearchField } from "@fanvue/ui";
import type { SearchFieldProps, SearchFieldSize } from "@fanvue/ui";
```

## Examples

## Default

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

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

<SearchField placeholder="Search..." />
```

## With Label

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

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

<SearchField label="Search" placeholder="Enter search terms" />
```

## All States

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

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

<div className="flex w-[375px] flex-col gap-4">
  <SearchField size="48" label="Size 48" placeholder="Search..." />
  <SearchField size="40" label="Size 40" placeholder="Search..." />
  <SearchField size="32" label="Size 32" placeholder="Search..." />
  <SearchField label="With helper" placeholder="Search..." helperText="Type to search" />
  <SearchField
    label="Error"
    placeholder="Search..."
    error
    errorMessage="Search query is too short"
  />
  <SearchField label="Disabled" placeholder="Search..." disabled />
</div>
```

## Text Overflow

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

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

<div className="flex w-[200px] flex-col gap-6">
  <SearchField
    placeholder="Search..."
    defaultValue="https://www.example.com/very/long/url/that/should/not/overflow/the/container/boundary"
  />
  <SearchField
    label="With label"
    placeholder="Search..."
    size="32"
    defaultValue="https://www.example.com/very/long/url/that/should/not/overflow/the/container/boundary"
  />
</div>
```

## With Clear Button

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

```tsx theme={null}
import { useState } from "react";
import { SearchField } from "@fanvue/ui";

function Example() {
  const [value, setValue] = useState("test query");

  return (
    <SearchField
      label="Search"
      placeholder="Search..."
      value={value}
      onChange={(e) => setValue(e.target.value)}
      onClear={() => setValue("")}
    />
  );
}
```

## Props

## SearchField

A text input field with a search icon and optional clear button.

<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="debounceMs" type="number">
  Debounce delay in milliseconds for the onChange callback. When set, the input maintains internal state for responsive typing while debouncing onChange to the parent.
</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="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="minChars" type="number">
  Minimum number of characters required before onChange fires. The input still updates visually, but onChange is suppressed until the threshold is met. Clearing always fires onClear regardless.
</ParamField>

<ParamField path="onClear" type="(() => void)">
  Callback fired when the clear button is clicked. If provided, a clear button appears when the field has a value.
</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">
  Size variant of the search field.
</ParamField>

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

## Exported types

Also exported from `@fanvue/ui`: `SearchFieldProps`, `SearchFieldSize`.

***

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